Пример #1
0
	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()
Пример #2
0
	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()
Пример #3
0
	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)