Allow broadcasts to be cancelled

Currently this is a `get` request from the dashboard. Once we have a page
for viewing an individual broadcast it should probably show there
instead and be a `get`/confirm/`post` loop like for deleting a template.
This commit is contained in:
Chris Hill-Scott
2020-07-10 09:16:36 +01:00
parent 23cd6b9c9e
commit 44e177b402
5 changed files with 62 additions and 7 deletions

View File

@@ -78,7 +78,7 @@ def test_broadcast_dashboard(
assert [
normalize_spaces(row.text) for row in page.select('table')[0].select('tbody tr')
] == [
'Example template To England and Scotland Live until tomorrow at 2:20am',
'Example template To England and Scotland Live until tomorrow at 2:20am Stop broadcasting',
]
assert [
normalize_spaces(row.text) for row in page.select('table')[1].select('tbody tr')
@@ -275,3 +275,28 @@ def test_start_broadcasting(
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
)
def test_cancel_broadcast(
client_request,
service_one,
mock_get_draft_broadcast_message,
mock_update_broadcast_message_status,
fake_uuid,
):
service_one['permissions'] += ['broadcast']
client_request.get(
'.cancel_broadcast_message',
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
_expected_redirect=url_for(
'.broadcast_dashboard',
service_id=SERVICE_ONE_ID,
_external=True,
),
),
mock_update_broadcast_message_status.assert_called_once_with(
'cancelled',
service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid,
)