mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Clear cache when cancelling broadcast via the API
Before we implemented ‘cancel’ any updates to a broadcast went through the admin app. This meant the admin app could deal with clearing the cache any time a broadcast was updated by a user performing an action. Now that a broadcast can be updated without the admin app being involved we have another place we need to clear the cache from. If we don’t do this then the broadcast can look like it’s still going even though it’s successfully been cancelled.
This commit is contained in:
@@ -134,6 +134,8 @@ def test_valid_cancel_broadcast_request_calls_validate_and_update_broadcast_mess
|
||||
api_key = create_api_key(service=sample_broadcast_service)
|
||||
auth_header = create_service_authorization_header(service_id=sample_broadcast_service.id)
|
||||
|
||||
mock_redis_delete = mocker.patch('app.redis_store.delete')
|
||||
|
||||
# create a broadcast
|
||||
response_for_create = client.post(
|
||||
path='/v2/broadcast',
|
||||
@@ -165,6 +167,9 @@ def test_valid_cancel_broadcast_request_calls_validate_and_update_broadcast_mess
|
||||
expected_status,
|
||||
api_key_id=api_key.id
|
||||
)
|
||||
mock_redis_delete.assert_called_once_with(
|
||||
f'service-{sample_broadcast_service.id}-broadcast-message-{broadcast_message.id}'
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cap_xml_document, expected_status, expected_error', (
|
||||
|
||||
Reference in New Issue
Block a user