mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-15 19:01:04 -04:00
rewrite one of the obsolete test
This commit is contained in:
@@ -151,7 +151,7 @@ def check_token_against_dummy_bearer(token):
|
||||
return ''
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/api/callbacks", methods=['GET', 'POST'])
|
||||
@main.route("/services/<service_id>/api/callbacks", methods=['GET'])
|
||||
@login_required
|
||||
def api_callbacks(service_id):
|
||||
if 'inbound_sms' not in current_service['permissions']:
|
||||
|
||||
@@ -395,40 +395,6 @@ def test_should_validate_whitelist_items(
|
||||
mock_update_whitelist.assert_not_called()
|
||||
|
||||
|
||||
def test_save_callback_apis_without_changes_does_not_update_callback_apis(
|
||||
client_request,
|
||||
service_one,
|
||||
mocker,
|
||||
mock_get_valid_service_callback_api,
|
||||
mock_get_valid_service_inbound_api,
|
||||
mock_update_service_callback_api,
|
||||
mock_update_service_inbound_api,
|
||||
mock_get_notifications,
|
||||
fake_uuid,
|
||||
):
|
||||
service_one['service_callback_api'] = [fake_uuid]
|
||||
service_one['inbound_api'] = [fake_uuid]
|
||||
service_one['permissions'] = ['inbound_sms']
|
||||
|
||||
callback_api_data = {
|
||||
'outbound_url': "https://hello2.gov.uk",
|
||||
'outbound_bearer_token': 'bearer_token_set',
|
||||
'inbound_url': "https://hello3.gov.uk",
|
||||
'inbound_bearer_token': 'bearer_token_set',
|
||||
'user_id': fake_uuid
|
||||
}
|
||||
|
||||
client_request.post(
|
||||
'main.api_callbacks',
|
||||
service_id=service_one['id'],
|
||||
_data=callback_api_data,
|
||||
_follow_redirects=True,
|
||||
)
|
||||
|
||||
assert mock_update_service_callback_api.called is False
|
||||
assert mock_update_service_inbound_api.called is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize('endpoint', [
|
||||
('main.delivery_status_callback'),
|
||||
('main.received_text_messages_callback'),
|
||||
@@ -671,3 +637,23 @@ def test_update_delivery_status_and_receive_text_message_callbacks_without_chang
|
||||
assert mock_update_service_inbound_api.called is False
|
||||
else:
|
||||
assert mock_update_service_callback_api.called is False
|
||||
|
||||
|
||||
def test_callbacks_page_works_when_no_apis_set(
|
||||
client_request,
|
||||
service_one,
|
||||
mocker
|
||||
):
|
||||
service_one['permissions'] = ['inbound_sms']
|
||||
mocker.patch('app.service_api_client.get_service_callback_api', side_effect={})
|
||||
mocker.patch('app.service_api_client.get_service_inbound_api', side_effect={})
|
||||
|
||||
page = client_request.get('main.api_callbacks',
|
||||
service_id=service_one['id'],
|
||||
_follow_redirects=True)
|
||||
expected_rows = ['Delivery status callback URL Not set Change',
|
||||
'Received text messages callback URL Not set Change']
|
||||
rows = page.select('tr')
|
||||
assert len(rows) == 3
|
||||
for index, row in enumerate(expected_rows):
|
||||
assert row == " ".join(rows[index + 1].text.split())
|
||||
|
||||
Reference in New Issue
Block a user