notify-542: move to 24 hour time for UTC

This commit is contained in:
Kenneth Kehl
2023-06-26 08:42:04 -07:00
parent 63d5061423
commit ed274bd266
4 changed files with 43 additions and 57 deletions

View File

@@ -56,40 +56,39 @@ def test_format_number_in_pounds_as_currency(input_number, formatted_number):
@pytest.mark.parametrize('time, human_readable_datetime', [
# incoming in UTC, outgoing in local timezone
# this test assumes timezone is America/New_York
('2018-03-14 09:00', '14 March at 9:00am'),
('2018-03-14 19:00', '14 March at 7:00pm'),
# incoming in UTC, outgoing in "human formatted" UTC
('2018-03-14 09:00', '14 March at 09:00'),
('2018-03-14 19:00', '14 March at 19:00'),
('2018-03-15 09:00', '15 March at 9:00am'),
('2018-03-15 19:00', '15 March at 7:00pm'),
('2018-03-15 09:00', '15 March at 09:00'),
('2018-03-15 19:00', '15 March at 19:00'),
('2018-03-19 09:00', '19 March at 9:00am'),
('2018-03-19 19:00', '19 March at 7:00pm'),
('2018-03-19 23:59', '19 March at 11:59pm'),
('2018-03-19 09:00', '19 March at 09:00'),
('2018-03-19 19:00', '19 March at 19:00'),
('2018-03-19 23:59', '19 March at 23:59'),
('2018-03-20 00:00', '19 March at midnight'), # we specifically refer to 00:00 as belonging to the day before.
('2018-03-20 04:01', 'yesterday at 4:01am'),
('2018-03-20 09:00', 'yesterday at 9:00am'),
('2018-03-20 19:00', 'yesterday at 7:00pm'),
('2018-03-20 23:59', 'yesterday at 11:59pm'),
('2018-03-20 00:00', '19 March at 00:00'), # we specifically refer to 00:00 as belonging to the day before.
('2018-03-20 04:01', 'yesterday at 04:01'),
('2018-03-20 09:00', 'yesterday at 09:00'),
('2018-03-20 19:00', 'yesterday at 19:00'),
('2018-03-20 23:59', 'yesterday at 23:59'),
('2018-03-21 00:00', 'yesterday at midnight'), # we specifically refer to 00:00 as belonging to the day before.
('2018-03-21 04:01', 'today at 4:01am'),
('2018-03-21 09:00', 'today at 9:00am'),
('2018-03-21 12:00', 'today at noon'),
('2018-03-21 19:00', 'today at 7:00pm'),
('2018-03-21 23:59', 'today at 11:59pm'),
('2018-03-21 00:00', 'yesterday at 00:00'), # we specifically refer to 00:00 as belonging to the day before.
('2018-03-21 04:01', 'today at 04:01'),
('2018-03-21 09:00', 'today at 09:00'),
('2018-03-21 12:00', 'today at 12:00'),
('2018-03-21 19:00', 'today at 19:00'),
('2018-03-21 23:59', 'today at 23:59'),
('2018-03-22 00:00', 'today at midnight'), # we specifically refer to 00:00 as belonging to the day before.
('2018-03-22 04:01', 'tomorrow at 4:01am'),
('2018-03-22 09:00', 'tomorrow at 9:00am'),
('2018-03-22 19:00', 'tomorrow at 7:00pm'),
('2018-03-22 23:59', 'tomorrow at 11:59pm'),
('2018-03-22 00:00', 'today at 00:00'),
('2018-03-22 04:01', 'tomorrow at 04:01'),
('2018-03-22 09:00', 'tomorrow at 09:00'),
('2018-03-22 19:00', 'tomorrow at 19:00'),
('2018-03-22 23:59', 'tomorrow at 23:59'),
('2018-03-23 04:01', '23 March at 4:01am'),
('2018-03-23 09:00', '23 March at 9:00am'),
('2018-03-23 19:00', '23 March at 7:00pm'),
('2018-03-23 04:01', '23 March at 04:01'),
('2018-03-23 09:00', '23 March at 09:00'),
('2018-03-23 19:00', '23 March at 19:00'),
])
def test_format_datetime_relative(time, human_readable_datetime):

View File

@@ -153,7 +153,7 @@ def test_can_show_notifications(
assert normalize_spaces(
first_row.select_one('.table-field-right-aligned .align-with-message-body').text
) == (
'Delivered 1 January at 6:01am'
'Delivered 1 January at 06:01'
)
assert page_title in page.h1.text.strip()
@@ -626,16 +626,16 @@ def test_redacts_templates_that_should_be_redacted(
@freeze_time("2017-09-27 12:30:00.000000")
@pytest.mark.parametrize(
"message_type, status, expected_hint_status, single_line", [
('email', 'created', 'Sending since 27 September at 12:30pm', True),
('email', 'sending', 'Sending since 27 September at 12:30pm', True),
('email', 'temporary-failure', 'Inbox not accepting messages right now 27 September at 12:31pm', False),
('email', 'permanent-failure', 'Email address does not exist 27 September at 12:31pm', False),
('email', 'delivered', 'Delivered 27 September at 12:31pm', True),
('sms', 'created', 'Sending since 27 September at 12:30pm', True),
('sms', 'sending', 'Sending since 27 September at 12:30pm', True),
('sms', 'temporary-failure', 'Phone not accepting messages right now 27 September at 12:31pm', False),
('sms', 'permanent-failure', 'Not delivered 27 September at 12:31pm', False),
('sms', 'delivered', 'Delivered 27 September at 12:31pm', True),
('email', 'created', 'Sending since 27 September at 12:30', True),
('email', 'sending', 'Sending since 27 September at 12:30', True),
('email', 'temporary-failure', 'Inbox not accepting messages right now 27 September at 12:31', False),
('email', 'permanent-failure', 'Email address does not exist 27 September at 12:31', False),
('email', 'delivered', 'Delivered 27 September at 12:31', True),
('sms', 'created', 'Sending since 27 September at 12:30', True),
('sms', 'sending', 'Sending since 27 September at 12:30', True),
('sms', 'temporary-failure', 'Phone not accepting messages right now 27 September at 12:31', False),
('sms', 'permanent-failure', 'Not delivered 27 September at 12:31', False),
('sms', 'delivered', 'Delivered 27 September at 12:31', True),
]
)
def test_sending_status_hint_displays_correctly_on_notifications_page(