def test_update_user(app, organization): user = services.create_user(USER1_EMAIL, A_PASSWORD, A_FIRST, A_LAST) user = services.update_user(user, "*****@*****.**", "Bob", "Thomas") assert user.first_name == "Bob" assert user.last_name == "Thomas" assert user.email == "*****@*****.**"
def test_update_user_validate_email(app, organization): user = services.create_user(USER1_EMAIL, A_PASSWORD, A_FIRST, A_LAST) with pytest.raises(ValueError): # badly formatted email services.update_user(user, "ttt", "Bob", "Thomas") with pytest.raises(TypeError): # no email services.update_user(user, "Bob", "Thomas") with pytest.raises(ValueError): # None type services.update_user(user, None, "Bob", "Thomas")
def test_update_user_validate_user(app, organization): user = services.create_user(USER1_EMAIL, A_PASSWORD, A_FIRST, A_LAST) with pytest.raises(ValueError): # badly formatted user services.update_user(1, "*****@*****.**", "Bob", "Thomas") with pytest.raises(TypeError): # no user services.update_user("*****@*****.**", "Bob", "Thomas") with pytest.raises(ValueError): # None type for first_name services.update_user(None, "*****@*****.**", "Bob", "Thomas")
def test_update_user_validate_last_name(app, organization): user = services.create_user(USER1_EMAIL, A_PASSWORD, A_FIRST, A_LAST) with pytest.raises(ValueError): # badly formatted first_name services.update_user(user, "*****@*****.**", "Bob", 1) with pytest.raises(TypeError): # no first_name services.update_user(user, "*****@*****.**", "Bob") with pytest.raises(ValueError): # None type for first_name services.update_user(user, "*****@*****.**", "Bob", None)