mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 14:39:49 -04:00
Change code order for Redis delete decorator
Before, the delete decorator would delete the keys from Redis and then we made the request to api to change the data. However, it is possible that the cache could get re-populated in between these two things happening, and so would cache outdated data. This changes the order to send the api request first. We then always delete the specified keys from Redis. Changing the order of the code in the decorator changes the order in which the cache keys get deleted, so the tests have been updated.
This commit is contained in:
@@ -150,7 +150,7 @@ def test_update_organisation_when_not_updating_org_type(mocker, fake_uuid):
|
||||
url='/organisations/{}'.format(fake_uuid),
|
||||
data={'foo': 'bar'}
|
||||
)
|
||||
assert mock_redis_delete.call_args_list == [call('domains'), call('organisations')]
|
||||
assert mock_redis_delete.call_args_list == [call('organisations'), call('domains')]
|
||||
|
||||
|
||||
def test_update_organisation_when_updating_org_type_and_org_has_services(mocker, fake_uuid):
|
||||
@@ -168,9 +168,9 @@ def test_update_organisation_when_updating_org_type_and_org_has_services(mocker,
|
||||
data={'organisation_type': 'central'}
|
||||
)
|
||||
assert mock_redis_delete.call_args_list == [
|
||||
call('domains'),
|
||||
call('organisations'),
|
||||
call('service-a', 'service-b', 'service-c'),
|
||||
call('organisations'),
|
||||
call('domains'),
|
||||
]
|
||||
|
||||
|
||||
@@ -189,6 +189,6 @@ def test_update_organisation_when_updating_org_type_but_org_has_no_services(mock
|
||||
data={'organisation_type': 'central'}
|
||||
)
|
||||
assert mock_redis_delete.call_args_list == [
|
||||
call('domains'),
|
||||
call('organisations'),
|
||||
call('domains'),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user