mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
merge from main
This commit is contained in:
@@ -520,7 +520,7 @@ def test_get_status_filters_calculates_stats(client_request):
|
||||
|
||||
assert {label: count for label, _option, _link, count in ret} == {
|
||||
'total': 6,
|
||||
'sending': 3,
|
||||
'pending': 3,
|
||||
'failed': 2,
|
||||
'delivered': 1
|
||||
}
|
||||
@@ -530,7 +530,7 @@ def test_get_status_filters_in_right_order(client_request):
|
||||
ret = get_status_filters(Service({'id': 'foo'}), 'sms', STATISTICS)
|
||||
|
||||
assert [label for label, _option, _link, _count in ret] == [
|
||||
'total', 'sending', 'delivered', 'failed'
|
||||
'total', 'pending', 'delivered', 'failed'
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ def test_robots(client_request):
|
||||
('bat_phone', {}),
|
||||
('thanks', {}),
|
||||
('register', {}),
|
||||
('features_email', {}),
|
||||
pytest.param('index', {}, marks=pytest.mark.xfail(raises=AssertionError)),
|
||||
))
|
||||
@freeze_time('2012-12-12 12:12') # So we don’t go out of business hours
|
||||
@@ -116,12 +115,17 @@ def test_static_pages(
|
||||
session['service_id'] = None
|
||||
request()
|
||||
|
||||
# Check it still works when they sign out
|
||||
# Check it redirects to the login screen when they sign out
|
||||
client_request.logout()
|
||||
with client_request.session_transaction() as session:
|
||||
session['service_id'] = None
|
||||
session['user_id'] = None
|
||||
request()
|
||||
request(
|
||||
_expected_status=302,
|
||||
_expected_redirect='/sign-in?next={}'.format(
|
||||
url_for('main.{}'.format(view))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_guidance_pages_link_to_service_pages_when_signed_in(
|
||||
@@ -143,12 +147,12 @@ def test_guidance_pages_link_to_service_pages_when_signed_in(
|
||||
page = request()
|
||||
assert not page.select_one(selector)
|
||||
|
||||
# Check it still works when they sign out
|
||||
# Check it redirects to the login screen when they sign out
|
||||
client_request.logout()
|
||||
with client_request.session_transaction() as session:
|
||||
session['service_id'] = None
|
||||
session['user_id'] = None
|
||||
page = request()
|
||||
page = request(_expected_status=302)
|
||||
assert not page.select_one(selector)
|
||||
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ def test_should_show_job_in_progress(
|
||||
normalize_spaces(link.text)
|
||||
for link in page.select('.pill a:not(.pill-item--selected)')
|
||||
] == [
|
||||
'10 sending text messages', '0 delivered text messages', '0 failed text messages'
|
||||
'10 pending text messages', '0 delivered text messages', '0 failed text messages'
|
||||
]
|
||||
assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…'
|
||||
|
||||
@@ -207,7 +207,7 @@ def test_should_show_job_without_notifications(
|
||||
normalize_spaces(link.text)
|
||||
for link in page.select('.pill a:not(.pill-item--selected)')
|
||||
] == [
|
||||
'10 sending text messages', '0 delivered text messages', '0 failed text messages'
|
||||
'10 pending text messages', '0 delivered text messages', '0 failed text messages'
|
||||
]
|
||||
assert page.select_one('p.hint').text.strip() == 'Report is 50% complete…'
|
||||
assert page.select_one('tbody').text.strip() == 'No messages to show yet…'
|
||||
@@ -307,7 +307,7 @@ def test_should_show_old_job(
|
||||
for column in page.select('main .govuk-grid-column-one-quarter')
|
||||
] == [
|
||||
'1 total text messages',
|
||||
'1 sending text message',
|
||||
'1 pending',
|
||||
'0 delivered text messages',
|
||||
'0 failed text messages',
|
||||
]
|
||||
@@ -395,7 +395,7 @@ def test_should_show_updates_for_one_job_as_json(
|
||||
)
|
||||
|
||||
content = json.loads(response.get_data(as_text=True))
|
||||
assert 'sending' in content['counts']
|
||||
assert 'pending' in content['counts']
|
||||
assert 'delivered' in content['counts']
|
||||
assert 'failed' in content['counts']
|
||||
assert 'Recipient' in content['notifications']
|
||||
@@ -432,7 +432,7 @@ def test_should_show_updates_for_scheduled_job_as_json(
|
||||
)
|
||||
|
||||
content = response.json
|
||||
assert 'sending' in content['counts']
|
||||
assert 'pending' in content['counts']
|
||||
assert 'delivered' in content['counts']
|
||||
assert 'failed' in content['counts']
|
||||
assert 'Recipient' in content['notifications']
|
||||
|
||||
@@ -15,7 +15,8 @@ from tests.conftest import (
|
||||
|
||||
@pytest.mark.parametrize('key_type, notification_status, expected_status', [
|
||||
(None, 'created', 'Sending'),
|
||||
(None, 'sending', 'Sending'),
|
||||
(None, 'sending',
|
||||
"Pending. Messages will remain in pending state until carrier status is received, typically 5 minutes."),
|
||||
(None, 'delivered', 'Delivered'),
|
||||
(None, 'failed', 'Failed'),
|
||||
(None, 'temporary-failure', 'Phone not accepting messages right now'),
|
||||
@@ -23,7 +24,8 @@ from tests.conftest import (
|
||||
(None, 'technical-failure', 'Technical failure'),
|
||||
('team', 'delivered', 'Delivered'),
|
||||
('live', 'delivered', 'Delivered'),
|
||||
('test', 'sending', 'Sending (test)'),
|
||||
('test', 'sending',
|
||||
"Pending. Messages will remain in pending state until carrier status is received, typically 5 minutes. (test)"),
|
||||
('test', 'delivered', 'Delivered (test)'),
|
||||
('test', 'permanent-failure', 'Not delivered (test)'),
|
||||
])
|
||||
|
||||
@@ -522,7 +522,6 @@ def test_can_create_email_template_with_parent_folder(
|
||||
'template_content': "here's a burrito 🌯",
|
||||
'template_type': 'email',
|
||||
'service': SERVICE_ONE_ID,
|
||||
'process_type': 'normal',
|
||||
'parent_folder_id': PARENT_FOLDER_ID
|
||||
}
|
||||
client_request.post('.add_service_template',
|
||||
@@ -540,7 +539,6 @@ def test_can_create_email_template_with_parent_folder(
|
||||
data['template_content'],
|
||||
SERVICE_ONE_ID,
|
||||
data['subject'],
|
||||
data['process_type'],
|
||||
data['parent_folder_id'])
|
||||
|
||||
|
||||
|
||||
@@ -658,7 +658,7 @@ def test_should_show_page_template_with_priority_select_if_platform_admin(
|
||||
|
||||
assert page.select_one('input[name=name]')['value'] == "Two week reminder"
|
||||
assert "Template <em>content</em> with & entity" in str(page.select_one('textarea'))
|
||||
assert "Use priority queue?" in page.text
|
||||
assert "Use priority queue?" not in page.text
|
||||
mock_get_service_template.assert_called_with(service_one['id'], template_id, None)
|
||||
|
||||
|
||||
@@ -1110,7 +1110,6 @@ def test_should_redirect_when_saving_a_template(
|
||||
'template_content': content,
|
||||
'template_type': 'sms',
|
||||
'service': SERVICE_ONE_ID,
|
||||
'process_type': 'normal',
|
||||
},
|
||||
_expected_status=302,
|
||||
_expected_redirect=url_for(
|
||||
@@ -1120,7 +1119,7 @@ def test_should_redirect_when_saving_a_template(
|
||||
),
|
||||
)
|
||||
mock_update_service_template.assert_called_with(
|
||||
fake_uuid, name, 'sms', content, SERVICE_ONE_ID, None, 'normal',
|
||||
fake_uuid, name, 'sms', content, SERVICE_ONE_ID, None
|
||||
)
|
||||
|
||||
|
||||
@@ -1140,7 +1139,6 @@ def test_should_edit_content_when_process_type_is_priority_not_platform_admin(
|
||||
'template_content': "new template <em>content</em> with & entity",
|
||||
'template_type': 'sms',
|
||||
'service': SERVICE_ONE_ID,
|
||||
'process_type': 'priority',
|
||||
},
|
||||
_expected_status=302,
|
||||
_expected_redirect=url_for(
|
||||
@@ -1155,8 +1153,7 @@ def test_should_edit_content_when_process_type_is_priority_not_platform_admin(
|
||||
'sms',
|
||||
"new template <em>content</em> with & entity",
|
||||
SERVICE_ONE_ID,
|
||||
None,
|
||||
'priority'
|
||||
None
|
||||
)
|
||||
|
||||
|
||||
@@ -1420,7 +1417,6 @@ def test_should_redirect_when_saving_a_template_email(
|
||||
'template_type': 'email',
|
||||
'service': SERVICE_ONE_ID,
|
||||
'subject': subject,
|
||||
'process_type': 'normal'
|
||||
},
|
||||
_expected_status=302,
|
||||
_expected_redirect=url_for(
|
||||
@@ -1430,7 +1426,7 @@ def test_should_redirect_when_saving_a_template_email(
|
||||
),
|
||||
)
|
||||
mock_update_service_template.assert_called_with(
|
||||
fake_uuid, name, 'email', content, SERVICE_ONE_ID, subject, 'normal',
|
||||
fake_uuid, name, 'email', content, SERVICE_ONE_ID, subject
|
||||
)
|
||||
|
||||
|
||||
@@ -1803,7 +1799,6 @@ def test_should_create_sms_template_without_downgrading_unicode_characters(
|
||||
'template_content': msg,
|
||||
'template_type': template_type,
|
||||
'service': SERVICE_ONE_ID,
|
||||
'process_type': 'normal'
|
||||
},
|
||||
expected_status=302,
|
||||
)
|
||||
@@ -1814,8 +1809,7 @@ def test_should_create_sms_template_without_downgrading_unicode_characters(
|
||||
msg, # content
|
||||
ANY, # service_id
|
||||
ANY, # subject
|
||||
ANY, # process_type
|
||||
ANY, # parent_folder_id
|
||||
ANY # parent_folder_id
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ def test_get_upload_hub_page(
|
||||
assert normalize_spaces(uploads[0].text.strip()) == (
|
||||
'some.csv '
|
||||
'Sent 1 January 2016 at 11:09 '
|
||||
'0 sending 8 delivered 2 failed'
|
||||
'0 pending 8 delivered 2 failed'
|
||||
)
|
||||
assert uploads[0].select_one('a.file-list-filename-large')['href'] == (
|
||||
'/services/{}/jobs/job_id_1'.format(SERVICE_ONE_ID)
|
||||
|
||||
@@ -77,14 +77,14 @@ def _get_notifications_csv_mock(
|
||||
@pytest.mark.parametrize('created_by_name, expected_content', [
|
||||
(
|
||||
None, [
|
||||
'Recipient,Reference,Template,Type,Sent by,Sent by email,Job,Status,Time\n',
|
||||
'foo@bar.com,ref 1234,foo,sms,,sender@email.gsa.gov,,Delivered,1943-04-19 12:00:00\r\n',
|
||||
'Recipient,Template,Type,Sent by,Job,Status,Time\n',
|
||||
'foo@bar.com,foo,sms,,,Delivered,1943-04-19 12:00:00\r\n',
|
||||
]
|
||||
),
|
||||
(
|
||||
'Anne Example', [
|
||||
'Recipient,Reference,Template,Type,Sent by,Sent by email,Job,Status,Time\n',
|
||||
'foo@bar.com,ref 1234,foo,sms,Anne Example,sender@email.gsa.gov,,Delivered,1943-04-19 12:00:00\r\n',
|
||||
'Recipient,Template,Type,Sent by,Job,Status,Time\n',
|
||||
'foo@bar.com,foo,sms,Anne Example,,Delivered,1943-04-19 12:00:00\r\n',
|
||||
]
|
||||
),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user