mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
fix all tests
This commit is contained in:
@@ -114,55 +114,55 @@ def test_view_conversation(
|
||||
for index, expected in enumerate([
|
||||
(
|
||||
'message-8',
|
||||
'yesterday at 2:59pm',
|
||||
'yesterday at 14:59',
|
||||
),
|
||||
(
|
||||
'message-7',
|
||||
'yesterday at 2:59pm',
|
||||
'yesterday at 14:59',
|
||||
),
|
||||
(
|
||||
'message-6',
|
||||
'yesterday at 4:59pm',
|
||||
'yesterday at 16:59',
|
||||
),
|
||||
(
|
||||
'message-5',
|
||||
'yesterday at 6:59pm',
|
||||
'yesterday at 18:59',
|
||||
),
|
||||
(
|
||||
'message-4',
|
||||
'yesterday at 8:59pm',
|
||||
'yesterday at 20:59',
|
||||
),
|
||||
(
|
||||
'message-3',
|
||||
'yesterday at 10:59pm',
|
||||
'yesterday at 22:59',
|
||||
),
|
||||
(
|
||||
'message-2',
|
||||
'yesterday at 10:59pm',
|
||||
'yesterday at 22:59',
|
||||
),
|
||||
(
|
||||
'message-1',
|
||||
'yesterday at 11:00pm',
|
||||
'yesterday at 23:00',
|
||||
),
|
||||
(
|
||||
expected_outbound_content,
|
||||
'yesterday at midnight',
|
||||
'yesterday at 00:00',
|
||||
),
|
||||
(
|
||||
expected_outbound_content,
|
||||
'yesterday at midnight',
|
||||
'yesterday at 00:00',
|
||||
),
|
||||
(
|
||||
expected_outbound_content,
|
||||
'yesterday at midnight',
|
||||
'yesterday at 00:00',
|
||||
),
|
||||
(
|
||||
expected_outbound_content,
|
||||
'yesterday at midnight',
|
||||
'yesterday at 00:00',
|
||||
),
|
||||
(
|
||||
expected_outbound_content,
|
||||
'yesterday at midnight',
|
||||
'yesterday at 00:00',
|
||||
),
|
||||
]):
|
||||
assert (
|
||||
|
||||
@@ -648,7 +648,7 @@ def test_should_show_upcoming_jobs_on_dashboard(
|
||||
page.select_one('a.banner-dashboard').text
|
||||
) == (
|
||||
'2 files waiting to send '
|
||||
'sending starts today at 11:09am'
|
||||
'sending starts today at 11:09'
|
||||
)
|
||||
|
||||
assert page.select_one('a.banner-dashboard')['href'] == url_for(
|
||||
|
||||
@@ -9,34 +9,34 @@ from tests.conftest import SERVICE_ONE_ID, normalize_spaces
|
||||
(
|
||||
'12 December',
|
||||
(
|
||||
'Test User 6:13pm '
|
||||
'Test User 18:13 '
|
||||
'Renamed this service from ‘Before lunch’ to ‘After lunch’ '
|
||||
'Test User 5:12pm '
|
||||
'Test User 17:12 '
|
||||
'Renamed this service from ‘Example service’ to ‘Before lunch’'
|
||||
),
|
||||
),
|
||||
(
|
||||
'11 November',
|
||||
(
|
||||
'Test User 5:12pm '
|
||||
'Test User 17:12 '
|
||||
'Revoked the ‘Bad key’ API key'
|
||||
),
|
||||
),
|
||||
(
|
||||
'11 November 2011',
|
||||
(
|
||||
'Test User 4:11pm '
|
||||
'Test User 16:11 '
|
||||
'Created an API key called ‘Bad key’'
|
||||
),
|
||||
),
|
||||
(
|
||||
'10 October 2010',
|
||||
(
|
||||
'Test User 3:10pm '
|
||||
'Test User 15:10 '
|
||||
'Created an API key called ‘Good key’ '
|
||||
'Test User 2:09pm '
|
||||
'Test User 14:09 '
|
||||
'Created an API key called ‘Key event returned in non-chronological order’ '
|
||||
'Test User 6:01am '
|
||||
'Test User 06:01 '
|
||||
'Created this service and called it ‘Example service’'
|
||||
),
|
||||
),
|
||||
@@ -45,23 +45,23 @@ from tests.conftest import SERVICE_ONE_ID, normalize_spaces
|
||||
(
|
||||
'11 November',
|
||||
(
|
||||
'Test User 5:12pm '
|
||||
'Test User 17:12 '
|
||||
'Revoked the ‘Bad key’ API key'
|
||||
),
|
||||
),
|
||||
(
|
||||
'11 November 2011',
|
||||
(
|
||||
'Test User 4:11pm '
|
||||
'Test User 16:11 '
|
||||
'Created an API key called ‘Bad key’'
|
||||
),
|
||||
),
|
||||
(
|
||||
'10 October 2010',
|
||||
(
|
||||
'Test User 3:10pm '
|
||||
'Test User 15:10 '
|
||||
'Created an API key called ‘Good key’ '
|
||||
'Test User 2:09pm '
|
||||
'Test User 14:09 '
|
||||
'Created an API key called ‘Key event returned in non-chronological order’'
|
||||
),
|
||||
),
|
||||
@@ -70,16 +70,16 @@ from tests.conftest import SERVICE_ONE_ID, normalize_spaces
|
||||
(
|
||||
'12 December',
|
||||
(
|
||||
'Test User 6:13pm '
|
||||
'Test User 18:13 '
|
||||
'Renamed this service from ‘Before lunch’ to ‘After lunch’ '
|
||||
'Test User 5:12pm '
|
||||
'Test User 17:12 '
|
||||
'Renamed this service from ‘Example service’ to ‘Before lunch’'
|
||||
),
|
||||
),
|
||||
(
|
||||
'10 October 2010',
|
||||
(
|
||||
'Test User 6:01am '
|
||||
'Test User 06:01 '
|
||||
'Created this service and called it ‘Example service’'
|
||||
),
|
||||
),
|
||||
|
||||
@@ -83,7 +83,7 @@ def test_should_show_page_for_one_job(
|
||||
|
||||
assert page.h1.text.strip() == 'thisisatest.csv'
|
||||
assert ' '.join(page.find('tbody').find('tr').text.split()) == (
|
||||
'2021234567 template content Delivered 1 January at 11:10am'
|
||||
'2021234567 template content Delivered 1 January at 11:10'
|
||||
)
|
||||
assert page.find('div', {'data-key': 'notifications'})['data-resource'] == url_for(
|
||||
'main.view_job_updates',
|
||||
@@ -104,7 +104,7 @@ def test_should_show_page_for_one_job(
|
||||
assert normalize_spaces(page.select_one('tbody tr').text) == normalize_spaces(
|
||||
'2021234567 '
|
||||
'template content '
|
||||
'Delivered 1 January at 11:10am'
|
||||
'Delivered 1 January at 11:10'
|
||||
)
|
||||
assert page.select_one('tbody tr a')['href'] == url_for(
|
||||
'main.view_notification',
|
||||
@@ -329,7 +329,7 @@ def test_should_show_scheduled_job(
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select('main p')[1].text) == (
|
||||
'Sending Two week reminder tomorrow at 5:00am'
|
||||
'Sending Two week reminder tomorrow at 05:00'
|
||||
)
|
||||
assert page.select('main p a')[0]['href'] == url_for(
|
||||
'main.view_template_version',
|
||||
@@ -402,8 +402,8 @@ def test_should_show_updates_for_one_job_as_json(
|
||||
assert '2021234567' in content['notifications']
|
||||
assert 'Status' in content['notifications']
|
||||
assert 'Delivered' in content['notifications']
|
||||
assert '5:01am' in content['notifications']
|
||||
assert 'Sent by Test User on 1 January at 5:00am' in content['status']
|
||||
assert '05:01' in content['notifications']
|
||||
assert 'Sent by Test User on 1 January at 05:00' in content['status']
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 05:00:00.000001")
|
||||
@@ -439,8 +439,8 @@ def test_should_show_updates_for_scheduled_job_as_json(
|
||||
assert '2021234567' in content['notifications']
|
||||
assert 'Status' in content['notifications']
|
||||
assert 'Delivered' in content['notifications']
|
||||
assert '5:01am' in content['notifications']
|
||||
assert 'Sent by Test User on 1 June at 8:00pm' in content['status']
|
||||
assert '05:01' in content['notifications']
|
||||
assert 'Sent by Test User on 1 June at 20:00' in content['status']
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -182,16 +182,16 @@ def test_notification_status_shows_expected_back_link(
|
||||
|
||||
@pytest.mark.parametrize('time_of_viewing_page, expected_message', (
|
||||
('2012-01-01 06:01', (
|
||||
"‘sample template’ was sent by Test User today at 6:01am UTC"
|
||||
"‘sample template’ was sent by Test User today at 06:01 UTC"
|
||||
)),
|
||||
('2012-01-02 06:01', (
|
||||
"‘sample template’ was sent by Test User yesterday at 6:01am UTC"
|
||||
"‘sample template’ was sent by Test User yesterday at 06:01 UTC"
|
||||
)),
|
||||
('2012-01-03 06:01', (
|
||||
"‘sample template’ was sent by Test User on 1 January at 6:01am UTC"
|
||||
"‘sample template’ was sent by Test User on 1 January at 06:01 UTC"
|
||||
)),
|
||||
('2013-01-03 06:01', (
|
||||
"‘sample template’ was sent by Test User on 1 January 2012 at 6:01am UTC"
|
||||
"‘sample template’ was sent by Test User on 1 January 2012 at 06:01 UTC"
|
||||
)),
|
||||
))
|
||||
def test_notification_page_doesnt_link_to_template_in_tour(
|
||||
|
||||
@@ -188,7 +188,7 @@ def test_view_providers_shows_all_providers(
|
||||
assert table_data[1].text.strip() == "20"
|
||||
assert table_data[2].text.strip() == "42"
|
||||
assert table_data[3].text.strip() == "True"
|
||||
assert table_data[4].text.strip() == "16 January at 3:20pm"
|
||||
assert table_data[4].text.strip() == "16 January at 15:20"
|
||||
assert table_data[5].text.strip() == "Test User"
|
||||
|
||||
domestic_sms_second_row = domestic_sms_table.tbody.find_all('tr')[1]
|
||||
|
||||
@@ -472,7 +472,7 @@ def test_caseworker_sees_template_page_if_template_is_deleted(
|
||||
|
||||
content = str(page)
|
||||
assert url_for("main.send_one_off", service_id=SERVICE_ONE_ID, template_id=fake_uuid) not in content
|
||||
assert page.select('p.hint')[0].text.strip() == 'This template was deleted today at 3:00pm.'
|
||||
assert page.select('p.hint')[0].text.strip() == 'This template was deleted today at 15:00.'
|
||||
|
||||
mock_get_deleted_template.assert_called_with(SERVICE_ONE_ID, template_id, None)
|
||||
|
||||
@@ -1575,7 +1575,7 @@ def test_should_show_page_for_a_deleted_template(
|
||||
content = str(page)
|
||||
assert url_for("main.edit_service_template", service_id=SERVICE_ONE_ID, template_id=fake_uuid) not in content
|
||||
assert url_for("main.send_one_off", service_id=SERVICE_ONE_ID, template_id=fake_uuid) not in content
|
||||
assert page.select('p.hint')[0].text.strip() == 'This template was deleted today at 3:00pm.'
|
||||
assert page.select('p.hint')[0].text.strip() == 'This template was deleted today at 15:00.'
|
||||
assert 'Delete this template' not in page.select_one('main').text
|
||||
|
||||
mock_get_deleted_template.assert_called_with(SERVICE_ONE_ID, template_id, None)
|
||||
|
||||
@@ -48,7 +48,7 @@ def test_get_upload_hub_page(
|
||||
|
||||
assert normalize_spaces(uploads[0].text.strip()) == (
|
||||
'some.csv '
|
||||
'Sent 1 January 2016 at 11:09am '
|
||||
'Sent 1 January 2016 at 11:09 '
|
||||
'0 sending 8 delivered 2 failed'
|
||||
)
|
||||
assert uploads[0].select_one('a.file-list-filename-large')['href'] == (
|
||||
@@ -79,12 +79,12 @@ def test_uploads_page_shows_scheduled_jobs(
|
||||
),
|
||||
(
|
||||
'even_later.csv '
|
||||
'Sending 1 January 2016 at 11:09pm '
|
||||
'Sending 1 January 2016 at 23:09 '
|
||||
'1 text message waiting to send'
|
||||
),
|
||||
(
|
||||
'send_me_later.csv '
|
||||
'Sending 1 January 2016 at 11:09am '
|
||||
'Sending 1 January 2016 at 11:09 '
|
||||
'1 text message waiting to send'
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user