def test_01_save_and_delete(self): kwargs = {"username": self.person.name(), "email": self.person.email()} self.assertEqual(User.query.count(), 0) user = User(**kwargs) user.save() self.assertEqual(user.__repr__(), "<User {} ID {}>".format(kwargs["username"], 1)) self.assertEqual(User.query.count(), 1) user.delete() self.assertEqual(User.query.count(), 0)
def test_14_role_and_user_repr(self): u = User(username='******', email='*****@*****.**', password='******') self.assertTrue("<Role u'User'>" == u.role.__repr__()) self.assertTrue("<User john ID 3>" == u.__repr__())