mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 14:09:20 -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:
@@ -73,13 +73,13 @@ def test_move_templates_and_folders(mocker):
|
||||
},
|
||||
)
|
||||
assert mock_redis_delete.call_args_list == [
|
||||
call('service-{}-template-folders'.format(some_service_id)),
|
||||
call('service-{}-templates'.format(some_service_id)),
|
||||
call(
|
||||
'template-a-version-None',
|
||||
'template-b-version-None',
|
||||
'template-c-version-None',
|
||||
),
|
||||
call('service-{}-templates'.format(some_service_id)),
|
||||
call('service-{}-template-folders'.format(some_service_id)),
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user