def __init__(self, shortname, passwd, longname=None, devices=[]): self.name = shortname self.fullname = shortname if longname: self.fullname = longname self.passwd = PasswordProperty(passwd) self.devices = devices Model.__init__(self)
def test_get_user(self): from nagini.db.user import User from nagini.db.model import Model u = User('uname', 'testpass', 'longusername', devices=['mahserver', 'otherserver']) u_id = u.put() n = Model.get_by_id(u_id) assert u.name == n.name == 'uname' assert u.passwd == 'testpass' assert n.passwd == 'testpass' assert u.fullname == n.fullname == 'longusername' assert u.devices == n.devices == ['mahserver', 'otherserver'] n.delete()
def test_get_model(self): from nagini.db.model import Model m = Model() m.furniture = ['couch', 'table', 'chair', 'cabinet'] m.languages = {'python': 'whitespace', 'java': 'semicolon'} m.name = 'mahtestmodel' m.mahstuff = MahClass('aparam') m_id = m.put() n = m.get_by_id(m_id) assert m.furniture == n.furniture assert m.languages == n.languages assert m.name == n.name assert isinstance(m.mahstuff, MahClass) assert m.mahstuff.param == n.mahstuff.param assert n.mahstuff.param == 'aparam' n.delete()
def __init__(self, parent): self.parent = parent Model.__init__(self)
def __init__(cls): Model.__init__(cls)
def __init__(cls, queue, user): Model.__init__(cls)
def decode(self): #Grab the model and decode it, returning the reassembled Model instance from nagini.db.model import Model return Model.get_by_id(self.id)