def test_swagger_user(): user = UserFactory() as_dict = user.to_dict() reconstructed = User.from_dict(as_dict) assert reconstructed.email == user.email assert reconstructed.name == user.name assert reconstructed.key == user.key
def test_user(session, db, request): oldcount = User.query.count() testuser = UserFactory() testuser.save() assert User.query.count() > oldcount, 'User not created' testuser.set_password('magic123') assert verify_password('magic123',User.query.get(testuser.id).password),\ 'Password setting not working' with current_app.app_context(): assert None == testuser.to_dict().get( 'password'), "User displaying password"