notify-api-412 use black to enforce python coding style

This commit is contained in:
Kenneth Kehl
2023-08-25 09:12:23 -07:00
parent c6eb007386
commit 8c9721d8e2
201 changed files with 31655 additions and 28100 deletions
+26 -22
View File
@@ -9,14 +9,13 @@ from tests.conftest import SERVICE_ONE_ID
def test_should_render_forgot_password(client_request):
client_request.logout()
page = client_request.get('.forgot_password')
assert 'Well send you an email to create a new password.' in page.text
page = client_request.get(".forgot_password")
assert "Well send you an email to create a new password." in page.text
@pytest.mark.parametrize('email_address', [
'test@user.gsa.gov',
'someuser@notgovernment.com'
])
@pytest.mark.parametrize(
"email_address", ["test@user.gsa.gov", "someuser@notgovernment.com"]
)
def test_should_redirect_to_password_reset_sent_for_valid_email(
client_request,
fake_uuid,
@@ -25,14 +24,16 @@ def test_should_redirect_to_password_reset_sent_for_valid_email(
):
client_request.logout()
sample_user = user_json(email_address=email_address)
mocker.patch('app.user_api_client.send_reset_password_url', return_value=None)
mocker.patch("app.user_api_client.send_reset_password_url", return_value=None)
page = client_request.post(
'.forgot_password',
_data={'email_address': sample_user['email_address']},
".forgot_password",
_data={"email_address": sample_user["email_address"]},
_expected_status=200,
)
assert 'Click the link in the email to reset your password.' in page.text
app.user_api_client.send_reset_password_url.assert_called_once_with(sample_user['email_address'], next_string=None)
assert "Click the link in the email to reset your password." in page.text
app.user_api_client.send_reset_password_url.assert_called_once_with(
sample_user["email_address"], next_string=None
)
def test_forgot_password_sends_next_link_with_reset_password_email_request(
@@ -41,15 +42,16 @@ def test_forgot_password_sends_next_link_with_reset_password_email_request(
mocker,
):
client_request.logout()
sample_user = user_json(email_address='test@user.gsa.gov')
mocker.patch('app.user_api_client.send_reset_password_url', return_value=None)
sample_user = user_json(email_address="test@user.gsa.gov")
mocker.patch("app.user_api_client.send_reset_password_url", return_value=None)
client_request.post_url(
url_for('.forgot_password') + f"?next=/services/{SERVICE_ONE_ID}/templates",
_data={'email_address': sample_user['email_address']},
url_for(".forgot_password") + f"?next=/services/{SERVICE_ONE_ID}/templates",
_data={"email_address": sample_user["email_address"]},
_expected_status=200,
)
app.user_api_client.send_reset_password_url.assert_called_once_with(
sample_user['email_address'], next_string=f'/services/{SERVICE_ONE_ID}/templates'
sample_user["email_address"],
next_string=f"/services/{SERVICE_ONE_ID}/templates",
)
@@ -59,14 +61,16 @@ def test_should_redirect_to_password_reset_sent_for_missing_email(
mocker,
):
client_request.logout()
mocker.patch('app.user_api_client.send_reset_password_url', side_effect=HTTPError(Response(status=404),
'Not found'))
mocker.patch(
"app.user_api_client.send_reset_password_url",
side_effect=HTTPError(Response(status=404), "Not found"),
)
page = client_request.post(
'.forgot_password',
_data={'email_address': api_user_active['email_address']},
".forgot_password",
_data={"email_address": api_user_active["email_address"]},
_expected_status=200,
)
assert 'Click the link in the email to reset your password.' in page.text
assert "Click the link in the email to reset your password." in page.text
app.user_api_client.send_reset_password_url.assert_called_once_with(
api_user_active['email_address'], next_string=None
api_user_active["email_address"], next_string=None
)