mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Refactor archive to do one sync delete of all keys rather than many
Otherwise we could be waiting on 50 sync calls to redis to happen. This
way we do it in one sync call and follow the pattern of
b98f4561fa/app/notify_client/organisations_api_client.py (L56)
This commit is contained in:
@@ -479,3 +479,12 @@ def test_deletes_caches_when_modifying_templates(
|
||||
|
||||
assert mock_redis_delete.call_args_list == list(map(call, expected_cache_deletes))
|
||||
assert len(mock_request.call_args_list) == 1
|
||||
|
||||
|
||||
def test_deletes_cached_users_when_archiving_service(mocker):
|
||||
mock_redis_delete = mocker.patch('app.notify_client.service_api_client.cache.delete')
|
||||
mocker.patch('notifications_python_client.base.BaseAPIClient.request')
|
||||
|
||||
service_api_client.archive_service(SERVICE_ONE_ID, ["my-user-id1", "my-user-id2"])
|
||||
|
||||
assert mock_redis_delete.call_args_list == [call('user-my-user-id1', 'user-my-user-id2')]
|
||||
|
||||
Reference in New Issue
Block a user