def testRoles(self): user = User(email='*****@*****.**', password=MD5Type.generate('secret')) user.sessions.append(User.Session()) user.store(self.db) self.assertEqual(self.db[user.id][u'email'], u'*****@*****.**') json = make_safe_json(User,user,'mysessions') assert 'password' not in json assert 'token' not in json assert 'email' in json assert 'created_on' in json assert self.db[user.id]['password'] is not None u2 = User.load(self.db, user.id) self.assertTrue(u2.challenge_password(MD5Type.generate('secret')))
def testValidUser(self): user = User(email='*****@*****.**', password=MD5Type.generate('secret')) self.assertTrue(user.challenge_password(MD5Type.generate('secret'))) user.store(self.db) self.assertEqual(self.db[user.id][u'email'], u'*****@*****.**')