from sample import *

# Test Mother Methods

MotherBox(ClsPlanets, None, MO_DEL)
from mother.speaker import Speaker
#Speaker.set_log_level(1)

planet= ClsPlanets(dict(planet_name='myplanet_'), MO_SAVE)
planet.setFields(dict(planet_mass=12))
planet.update()
planet.update(dict(planet_mass=11))
planet.load(['planet_mass'])
planet= ClsPlanets(dict(planet_name= 'myplanet_'), MO_ULOAD)
print planet
planet.delete()

Sun= ClsStars(dict(star_name='sun_'), MO_SAVE)
planet= Sun.insertPlanets(dict(planet_name='uran'))
print planet
Sun.deleteMultiplePlanets()
planet= Sun.insertPlanets(dict(planet_name='uran'))
Sun.deleteMultiplePlanets(filter= dict(planet_name='uran'))
planet= Sun.insertPlanets(dict(planet_name='uran'))
Sun.deleteMultiplePlanets(filter= dict(planet_name='urano'))
planet= Sun.getMultiplePlanets(filter= dict(planet_name='urano'))
print len(planet)
planet= Sun.getMultiplePlanets(filter= dict(planet_name='uran'))
print len(planet)
planet= planet.getRecords(True)[0]
print planet
Sun.updateMultiplePlanets(dict(planet_mass=12), filter=dict(planet_name='urano'))
Sun.updateMultiplePlanets(dict(planet_mass=12), filter=dict(planet_name='uran'))
planet= Sun.getMultiplePlanets(filter= dict(planet_name='uran'))
planet= planet.getRecords(True)[0]
Sun.deleteMultiplePlanets()

planet= Sun.insertPlanets(dict(planet_name='uran'))
planet.assignLifes(dict(life_name='uraniaa1'), MO_SAVE)
planet.assignLifes(dict(life_name='uranian2'), MO_SAVE)
box= planet.joinLifes()
box= planet.joinLifes(jfilter=dict(life_name='uranian2'))
box= planet.joinLifes(filter= dict(life_id=12), jfilter=dict(life_name='uranian2'))
planet.dropMultipleLifes(filter= dict(life_id=12), jfilter=dict(life_name='uranian2'))
planet.dropMultipleLifes(filter= dict(life_id=12))
planet.dropMultipleLifes(jfilter=dict(life_name='uranian2'))
planet.assignLifes(dict(life_name='uraniaa1'), MO_SAVE)
az=planet.assignLifes(dict(life_name='uranian2'), MO_SAVE)
print az
