Add test for back link on view broadcast page

This commit is contained in:
Chris Hill-Scott
2020-10-26 11:06:27 +00:00
parent eec4602efc
commit 725df2e7fa

View File

@@ -1118,26 +1118,31 @@ def test_view_broadcast_message_page(
'.view_current_broadcast', '.view_current_broadcast',
'.view_previous_broadcast', '.view_previous_broadcast',
)) ))
@pytest.mark.parametrize('status, expected_highlighted_navigation_item', ( @pytest.mark.parametrize('status, expected_highlighted_navigation_item, expected_back_link_endpoint', (
( (
'pending-approval', 'pending-approval',
'Current alerts', 'Current alerts',
'.broadcast_dashboard',
), ),
( (
'broadcasting', 'broadcasting',
'Current alerts', 'Current alerts',
'.broadcast_dashboard',
), ),
( (
'completed', 'completed',
'Previous alerts', 'Previous alerts',
'.broadcast_dashboard_previous',
), ),
( (
'cancelled', 'cancelled',
'Previous alerts', 'Previous alerts',
'.broadcast_dashboard_previous',
), ),
( (
'rejected', 'rejected',
'Previous alerts', 'Previous alerts',
'.broadcast_dashboard_previous',
), ),
)) ))
@freeze_time('2020-02-22T22:22:22.000000') @freeze_time('2020-02-22T22:22:22.000000')
@@ -1151,6 +1156,7 @@ def test_view_broadcast_message_shows_correct_highlighted_navigation(
endpoint, endpoint,
status, status,
expected_highlighted_navigation_item, expected_highlighted_navigation_item,
expected_back_link_endpoint,
): ):
mocker.patch( mocker.patch(
'app.broadcast_message_api_client.get_broadcast_message', 'app.broadcast_message_api_client.get_broadcast_message',
@@ -1181,6 +1187,11 @@ def test_view_broadcast_message_shows_correct_highlighted_navigation(
expected_highlighted_navigation_item expected_highlighted_navigation_item
) )
assert page.select_one('.govuk-back-link')['href'] == url_for(
expected_back_link_endpoint,
service_id=SERVICE_ONE_ID,
)
@freeze_time('2020-02-22T22:22:22.000000') @freeze_time('2020-02-22T22:22:22.000000')
def test_view_pending_broadcast( def test_view_pending_broadcast(