Always use 12h times

The GOV.UK content style guide says:

> - 5:30pm (not 1730hrs)
> - midnight (not 00:00)
> - midday (not 12 noon, noon or 12pm)

This commit changes all times to be 12h not 24h, and adds a special case
for when a time is exactly 12:00am or 12:00pm.
This commit is contained in:
Chris Hill-Scott
2016-08-26 08:06:28 +01:00
parent c1415c0429
commit 3d8d160d3e
5 changed files with 37 additions and 14 deletions

View File

@@ -39,7 +39,7 @@ def test_should_show_api_keys_page(app_,
resp_data = response.get_data(as_text=True)
assert 'some key name' in resp_data
assert 'another key name' in resp_data
assert 'Revoked 1 January at 01:00' in resp_data
assert 'Revoked 1 January at 1:00am' in resp_data
mock_get_api_keys.assert_called_once_with(service_id=fake_uuid)

View File

@@ -78,7 +78,7 @@ def test_should_show_page_for_one_job(
'{}: Your vehicle tax is about to expire'.format(service_one['name'])
)
assert ' '.join(page.find('tbody').find('tr').text.split()) == (
'07123456789 1 January at 11:10 Delivered'
'07123456789 1 January at 11:10am Delivered'
)
assert page.find('div', {'data-key': 'notifications'})['data-resource'] == url_for(
'main.view_job_updates',
@@ -160,7 +160,7 @@ def test_should_show_not_show_csv_download_in_tour(
) not in response.get_data(as_text=True)
@freeze_time("2016-01-01 11:09:00.061258")
@freeze_time("2016-01-01 00:00:00.000001")
def test_should_show_updates_for_one_job_as_json(
app_,
service_one,
@@ -185,8 +185,8 @@ def test_should_show_updates_for_one_job_as_json(
assert '07123456789' in content['notifications']
assert 'Status' in content['notifications']
assert 'Delivered' in content['notifications']
assert '11:10' in content['notifications']
assert 'Uploaded by Test User on 1 January at 11:09' in content['status']
assert '12:01am' in content['notifications']
assert 'Uploaded by Test User on 1 January at midnight' in content['status']
@pytest.mark.parametrize(
@@ -335,7 +335,7 @@ def test_should_download_notifications_for_a_job(app_,
assert response.status_code == 200
assert response.get_data(as_text=True) == csv_content
assert 'text/csv' in response.headers['Content-Type']
assert 'sample template - 1 January at 11:09.csv"' in response.headers['Content-Disposition']
assert 'sample template - 1 January at 11:09am.csv"' in response.headers['Content-Disposition']
@pytest.mark.parametrize(

View File

@@ -25,7 +25,7 @@ def test_email_safe_return_dot_separated_email_domain():
('permanent-failure', 'sms', 'Phone number doesnt exist')
]
)
@freeze_time("2016-01-01 11:09:00.061258")
@freeze_time("2016-01-01 15:09:00.061258")
def test_generate_csv_from_notifications(
app_,
service_one,
@@ -46,5 +46,5 @@ def test_generate_csv_from_notifications(
)
for row in DictReader(StringIO(csv_content)):
assert row['Time'] == 'Friday 01 January 2016 at 11:09'
assert row['Time'] == 'Friday 01 January 2016 at 15:09'
assert row['Status'] == expected_status