def test_get_user_by_id(resource): UserRepo.add_user(username="******", password="******", email="*****@*****.**") users = UserRepo.get_all_users() assert len(users) == 1 uid = users[0].id stored_user = UserRepo.get_user_by_id(uid) assert stored_user.username == "user1" assert stored_user.email == "*****@*****.**" not_stored_user = UserRepo.get_user_by_id( random_objectid()) #should not be in the database assert not_stored_user == None resource
def load_user(user_id): return LoggedInUserWrapper(UserRepo.get_user_by_id(user_id))