Allow callbacks to be removed

We’ve had a user who’s said:

> Seems configured callbacks cannot be removed once they’re set as the
> fields have a presence check. Is that intentional?

This means it’s not working as they expect. Rather than have to go and
change stuff in the database for them, let’s make it work as they’d
expect.

Only lets you clear the form if you remove both the token and the URL.
This commit is contained in:
Chris Hill-Scott
2018-04-26 17:23:44 +01:00
committed by Leo Hemsted
parent 418a744283
commit c2dbc1934f
5 changed files with 144 additions and 11 deletions

View File

@@ -2720,6 +2720,22 @@ def mock_get_valid_service_callback_api(mocker):
return mocker.patch('app.service_api_client.get_service_callback_api', side_effect=_get)
@pytest.fixture(scope='function')
def mock_get_empty_service_inbound_api(mocker):
return mocker.patch(
'app.service_api_client.get_service_inbound_api',
side_effect=lambda service_id, callback_api_id: None,
)
@pytest.fixture(scope='function')
def mock_get_empty_service_callback_api(mocker):
return mocker.patch(
'app.service_api_client.get_service_callback_api',
side_effect=lambda service_id, callback_api_id: None,
)
@pytest.fixture(scope='function')
def mock_create_service_inbound_api(mocker):
def _create_service_inbound_api(service_id, url, bearer_token, user_id):
@@ -2728,6 +2744,14 @@ def mock_create_service_inbound_api(mocker):
return mocker.patch('app.service_api_client.create_service_inbound_api', side_effect=_create_service_inbound_api)
@pytest.fixture(scope='function')
def mock_delete_service_inbound_api(mocker):
return mocker.patch(
'app.service_api_client.delete_service_callback_api',
side_effect=lambda service_id: None
)
@pytest.fixture(scope='function')
def mock_update_service_inbound_api(mocker):
def _update_service_inbound_api(service_id, url, bearer_token, user_id, inbound_api_id):
@@ -2744,6 +2768,14 @@ def mock_create_service_callback_api(mocker):
return mocker.patch('app.service_api_client.create_service_callback_api', side_effect=_create_service_callback_api)
@pytest.fixture(scope='function')
def mock_delete_service_callback_api(mocker):
return mocker.patch(
'app.service_api_client.delete_service_callback_api',
side_effect=lambda service_id: None
)
@pytest.fixture(scope='function')
def mock_update_service_callback_api(mocker):
def _update_service_callback_api(service_id, url, bearer_token, user_id, callback_api_id):