rewrite one of the obsolete test

This commit is contained in:
venusbb
2017-12-11 17:17:40 +00:00
parent 3377efb267
commit 6f0ce3b33d
2 changed files with 21 additions and 35 deletions

View File

@@ -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']:

View File

@@ -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())