From e3fa1ac253a9791ecc95ed6fb394899a6674d33f Mon Sep 17 00:00:00 2001 From: Henry Hadlow Date: Tue, 10 May 2016 11:36:49 +0100 Subject: [PATCH] Tidy up text on forgot your password screens Display updated_at instead of created_at for notifications. --- app/templates/partials/jobs/notifications.html | 2 +- app/templates/views/forgot-password.html | 4 ++-- app/templates/views/notifications.html | 2 +- app/templates/views/password-reset-sent.html | 4 ++-- app/templates/views/signin.html | 2 +- requirements_for_test.txt | 1 + tests/__init__.py | 6 +++++- tests/app/main/views/test_forgot_password.py | 12 +++++------- tests/app/main/views/test_jobs.py | 3 +++ tests/app/main/views/test_sign_in.py | 2 +- 10 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/templates/partials/jobs/notifications.html b/app/templates/partials/jobs/notifications.html index 687f18889..f08637ce4 100644 --- a/app/templates/partials/jobs/notifications.html +++ b/app/templates/partials/jobs/notifications.html @@ -27,7 +27,7 @@ align='right', status='error' if item.status == 'Failed' else 'default' ) %} - {{ item.status|title }} at {{ item.sent_at|format_time }} + {{ item.status|title }} at {{ item.updated_at|format_time }} {% endcall %} {% endcall %} diff --git a/app/templates/views/forgot-password.html b/app/templates/views/forgot-password.html index b8e97ebb9..250a6319e 100644 --- a/app/templates/views/forgot-password.html +++ b/app/templates/views/forgot-password.html @@ -10,9 +10,9 @@ Create a new password – GOV.UK Notify
-

Create a new password

+

Forgot your password?

-

If you have forgotten your password, we can send you an email to create a new password.

+

We’ll send you an email to create a new password.

{{ textbox(form.email_address, safe_error_message=True) }} diff --git a/app/templates/views/notifications.html b/app/templates/views/notifications.html index e608fbb44..52017694d 100644 --- a/app/templates/views/notifications.html +++ b/app/templates/views/notifications.html @@ -94,7 +94,7 @@ {{ text_field(item.status|capitalize) }} {% call field(align='right') %} - {{ item.created_at|format_datetime_short }} + {{ item.updated_at|format_datetime_short }} {% endcall %} {% endcall %} diff --git a/app/templates/views/password-reset-sent.html b/app/templates/views/password-reset-sent.html index 9fc600a4a..5e9e62857 100644 --- a/app/templates/views/password-reset-sent.html +++ b/app/templates/views/password-reset-sent.html @@ -8,9 +8,9 @@ GOV.UK Notify
-

GOV.UK Notify

+

Now check your email

-

You have been sent an email containing a link to reset your password.

+

We’ve sent you an email with a link to reset your password.

diff --git a/app/templates/views/signin.html b/app/templates/views/signin.html index d08778e0e..719144e3a 100644 --- a/app/templates/views/signin.html +++ b/app/templates/views/signin.html @@ -17,7 +17,7 @@ {{ textbox(form.email_address) }} {{ textbox(form.password) }} - {{ page_footer("Continue", secondary_link=url_for('.forgot_password'), secondary_link_text="Forgotten password?") }} + {{ page_footer("Continue", secondary_link=url_for('.forgot_password'), secondary_link_text="Forgot your password?") }}
diff --git a/requirements_for_test.txt b/requirements_for_test.txt index 67db532df..3f3644dd7 100644 --- a/requirements_for_test.txt +++ b/requirements_for_test.txt @@ -7,3 +7,4 @@ coveralls==1.1 moto==0.4.23 httpretty==0.8.14 beautifulsoup4==4.4.1 +freezegun==0.3.6 diff --git a/tests/__init__.py b/tests/__init__.py index 6f2aa20e1..28929e720 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -138,6 +138,7 @@ def notification_json(service_id, status='sent', sent_at=None, created_at=None, + updated_at=None, with_links=False): if job is None: job = job_json() @@ -147,6 +148,8 @@ def notification_json(service_id, sent_at = str(datetime.datetime.utcnow().time()) if created_at is None: created_at = str(datetime.datetime.utcnow().time()) + if updated_at is None: + updated_at = str((datetime.datetime.utcnow() + datetime.timedelta(minutes=1)).time()) links = {} if with_links: links = { @@ -164,7 +167,8 @@ def notification_json(service_id, 'job': {'id': job['id'], 'original_file_name': job['original_file_name']}, 'sent_at': sent_at, 'status': status, - 'created_at': created_at + 'created_at': created_at, + 'updated_at': updated_at } for i in range(5)], 'total': 5, 'page_size': 50, diff --git a/tests/app/main/views/test_forgot_password.py b/tests/app/main/views/test_forgot_password.py index 7f45ce6c2..a195f3ea2 100644 --- a/tests/app/main/views/test_forgot_password.py +++ b/tests/app/main/views/test_forgot_password.py @@ -8,7 +8,7 @@ def test_should_render_forgot_password(app_): with app_.test_request_context(): response = app_.test_client().get(url_for('.forgot_password')) assert response.status_code == 200 - assert 'If you have forgotten your password, we can send you an email to create a new password.' \ + assert 'We’ll send you an email to create a new password.' \ in response.get_data(as_text=True) @@ -22,9 +22,8 @@ def test_should_redirect_to_password_reset_sent_for_valid_email( url_for('.forgot_password'), data={'email_address': api_user_active.email_address}) assert response.status_code == 200 - assert ( - 'You have been sent an email containing a link' - ' to reset your password.') in response.get_data(as_text=True) + assert 'We’ve sent you an email with a link to reset your password.' \ + in response.get_data(as_text=True) app.user_api_client.send_reset_password_url.assert_called_once_with(api_user_active.email_address) @@ -40,7 +39,6 @@ def test_should_redirect_to_password_reset_sent_for_missing_email( url_for('.forgot_password'), data={'email_address': api_user_active.email_address}) assert response.status_code == 200 - assert ( - 'You have been sent an email containing a link' - ' to reset your password.') in response.get_data(as_text=True) + assert 'We’ve sent you an email with a link to reset your password.' \ + in response.get_data(as_text=True) app.user_api_client.send_reset_password_url.assert_called_once_with(api_user_active.email_address) diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 53770caae..f0d834fbc 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -5,6 +5,7 @@ from app.utils import generate_notifications_csv from tests import notification_json, job_json_with_created_by from tests.conftest import fake_uuid from tests.conftest import mock_get_job as mock_get_job1 +from freezegun import freeze_time def test_should_return_list_of_all_jobs(app_, @@ -24,6 +25,7 @@ def test_should_return_list_of_all_jobs(app_, assert len(jobs) == 5 +@freeze_time("2016-01-01 11:09:00.061258") def test_should_show_page_for_one_job( app_, service_one, @@ -45,6 +47,7 @@ def test_should_show_page_for_one_job( content = response.get_data(as_text=True) assert "{}: Your vehicle tax is about to expire".format(service_one['name']) in content assert file_name in content + assert "Sent at 11:10" in content def test_should_show_updates_for_one_job_as_json( diff --git a/tests/app/main/views/test_sign_in.py b/tests/app/main/views/test_sign_in.py index 745f0d419..56e0a7abb 100644 --- a/tests/app/main/views/test_sign_in.py +++ b/tests/app/main/views/test_sign_in.py @@ -9,7 +9,7 @@ def test_render_sign_in_returns_sign_in_template(app_): assert 'Sign in' in response.get_data(as_text=True) assert 'Email address' in response.get_data(as_text=True) assert 'Password' in response.get_data(as_text=True) - assert 'Forgotten password?' in response.get_data(as_text=True) + assert 'Forgot your password?' in response.get_data(as_text=True) def test_logged_in_user_redirects_to_choose_service(app_,