Force user to fill out their user profile

This commit is contained in:
Patrick Smith
2018-10-30 15:31:56 -04:00
parent f8c4386d84
commit dd5f99faab
5 changed files with 95 additions and 4 deletions

View File

@@ -23,3 +23,21 @@ def test_user_can_update_profile(user_session, client):
updated_user = Users.get_by_dod_id(user.dod_id)
assert updated_user.first_name == "chad"
assert updated_user.last_name == "vader"
def test_user_is_redirected_when_updating_profile(user_session, client):
user = UserFactory.create()
user_session(user)
next_url = "/requests"
user_data = user.to_dictionary()
user_data["date_latest_training"] = user_data["date_latest_training"].strftime(
"%m/%d/%Y"
)
response = client.post(
url_for("users.update_user", next=next_url),
data=user_data,
follow_redirects=False,
)
assert response.status_code == 302
assert response.location.endswith(next_url)