Add a separate page for rejected alerts

We don’t want to mix these up with alerts that actually went out.
This commit is contained in:
Chris Hill-Scott
2021-04-08 13:09:29 +01:00
parent 9977028a83
commit dc4db4951a
5 changed files with 77 additions and 6 deletions

View File

@@ -358,7 +358,7 @@ def test_broadcast_dashboard(
@pytest.mark.parametrize('endpoint', (
'.broadcast_dashboard', '.broadcast_dashboard_previous',
'.broadcast_dashboard', '.broadcast_dashboard_previous', '.broadcast_dashboard_rejected',
))
def test_broadcast_dashboard_does_not_have_button_for_view_only_user(
client_request,
@@ -420,7 +420,6 @@ def test_previous_broadcasts_page(
normalize_spaces(row.text)
for row in page.select('.ajax-block-container')[0].select('.file-list')
] == [
'Example template This is a test Rejected today at 1:20am England Scotland',
'Example template This is a test Broadcast yesterday at 2:20pm England Scotland',
'Example template This is a test Broadcast yesterday at 2:20am England Scotland',
]
@@ -435,6 +434,40 @@ def test_previous_broadcasts_page(
)
@freeze_time('2020-02-20 02:20')
def test_rejected_broadcasts_page(
client_request,
service_one,
mock_get_broadcast_messages,
mock_get_service_templates,
):
service_one['permissions'] += ['broadcast']
page = client_request.get(
'.broadcast_dashboard_rejected',
service_id=SERVICE_ONE_ID,
)
assert normalize_spaces(page.select_one('main h1').text) == (
'Rejected alerts'
)
assert len(page.select('.ajax-block-container')) == 1
assert [
normalize_spaces(row.text)
for row in page.select('.ajax-block-container')[0].select('.file-list')
] == [
'Example template This is a test Rejected today at 1:20am England Scotland',
]
button = page.select_one(
'.js-stick-at-bottom-when-scrolling a.govuk-button.govuk-button--secondary'
)
assert normalize_spaces(button.text) == 'New alert'
assert button['href'] == url_for(
'main.new_broadcast',
service_id=SERVICE_ONE_ID,
)
def test_new_broadcast_page(
client_request,
service_one,
@@ -1419,6 +1452,7 @@ def test_view_broadcast_message_page(
@pytest.mark.parametrize('endpoint', (
'.view_current_broadcast',
'.view_previous_broadcast',
'.view_rejected_broadcast',
))
@pytest.mark.parametrize('status, expected_highlighted_navigation_item, expected_back_link_endpoint', (
(
@@ -1443,8 +1477,8 @@ def test_view_broadcast_message_page(
),
(
'rejected',
'Previous alerts',
'.broadcast_dashboard_previous',
'Rejected alerts',
'.broadcast_dashboard_rejected',
),
))
@freeze_time('2020-02-22T22:22:22.000000')