mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 07:46:23 -04:00
Add missing test for dodgy broadcast account types
This moves the redundant assertions for the service not changing to
where they're actually relevant, by comparing with the happy path [1].
[1]: c5196fbf07/tests/app/main/views/test_service_settings.py (L5858)
This commit is contained in:
@@ -5900,7 +5900,7 @@ def test_post_service_set_broadcast_network_makes_you_choose(
|
|||||||
]),
|
]),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def test_post_service_set_broadcast_account_type_confirmation_page(
|
def test_post_service_confirm_broadcast_account_type_confirmation_page(
|
||||||
client_request,
|
client_request,
|
||||||
platform_admin_user,
|
platform_admin_user,
|
||||||
value,
|
value,
|
||||||
@@ -5926,7 +5926,7 @@ def test_post_service_set_broadcast_account_type_confirmation_page(
|
|||||||
("live-government", "live", "government", "all"),
|
("live-government", "live", "government", "all"),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def test_post_service_set_broadcast_account_type_posts_data_to_api_and_redirects(
|
def test_post_service_confirm_broadcast_account_type_posts_data_to_api_and_redirects(
|
||||||
platform_admin_client,
|
platform_admin_client,
|
||||||
mocker,
|
mocker,
|
||||||
value,
|
value,
|
||||||
@@ -5962,13 +5962,35 @@ def test_post_service_set_broadcast_account_type_posts_data_to_api_and_redirects
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_post_service_set_broadcast_channel_makes_you_choose(
|
@pytest.mark.parametrize('account_type', (
|
||||||
|
'foo-severe',
|
||||||
|
'training-foo',
|
||||||
|
'live-foo',
|
||||||
|
'live-government-foo'
|
||||||
|
))
|
||||||
|
def test_post_service_confirm_broadcast_account_type_errors_for_unknown_type(
|
||||||
platform_admin_client,
|
platform_admin_client,
|
||||||
mocker,
|
mocker,
|
||||||
|
account_type,
|
||||||
):
|
):
|
||||||
set_service_broadcast_settings_mock = mocker.patch('app.service_api_client.set_service_broadcast_settings')
|
set_service_broadcast_settings_mock = mocker.patch('app.service_api_client.set_service_broadcast_settings')
|
||||||
mock_event_handler = mocker.patch('app.main.views.service_settings.create_broadcast_account_type_change_event')
|
mock_event_handler = mocker.patch('app.main.views.service_settings.create_broadcast_account_type_change_event')
|
||||||
|
|
||||||
|
response = platform_admin_client.post(
|
||||||
|
url_for(
|
||||||
|
'main.service_confirm_broadcast_account_type',
|
||||||
|
service_id=SERVICE_ONE_ID,
|
||||||
|
account_type=account_type,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
assert response.status_code == 404
|
||||||
|
assert not set_service_broadcast_settings_mock.called
|
||||||
|
assert not mock_event_handler.called
|
||||||
|
|
||||||
|
|
||||||
|
def test_post_service_set_broadcast_channel_makes_you_choose(
|
||||||
|
platform_admin_client,
|
||||||
|
):
|
||||||
response = platform_admin_client.post(
|
response = platform_admin_client.post(
|
||||||
url_for(
|
url_for(
|
||||||
'main.service_set_broadcast_channel',
|
'main.service_set_broadcast_channel',
|
||||||
@@ -5978,5 +6000,3 @@ def test_post_service_set_broadcast_channel_makes_you_choose(
|
|||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||||
assert 'Error: Select mode or channel' in page.find("span", {"class": "govuk-error-message"}).text
|
assert 'Error: Select mode or channel' in page.find("span", {"class": "govuk-error-message"}).text
|
||||||
assert not set_service_broadcast_settings_mock.called
|
|
||||||
assert not mock_event_handler.called
|
|
||||||
|
|||||||
Reference in New Issue
Block a user