mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-15 15:28:50 -04:00
Make it easy to clear cache for all key formats
Having to submit the form for each choice separately slowed us down during an incident where Redis was unavailable and came back with stale data, which we had to clear manually. Note: we don't want to use the "flush" feature in case there are other keys in Redis, which may not be safe to remove.
This commit is contained in:
@@ -735,7 +735,7 @@ def test_clear_cache_shows_form(
|
||||
page = client_request.get('main.clear_cache')
|
||||
|
||||
assert not redis.delete_cache_keys_by_pattern.called
|
||||
radios = {el['value'] for el in page.select('input[type=radio]')}
|
||||
radios = {el['value'] for el in page.select('input[type=checkbox]')}
|
||||
|
||||
assert radios == {
|
||||
'user',
|
||||
@@ -753,8 +753,8 @@ def test_clear_cache_shows_form(
|
||||
call('service-????????-????-????-????-????????????-templates'),
|
||||
call('service-????????-????-????-????-????????????-template-????????-????-????-????-????????????-version-*'),
|
||||
call('service-????????-????-????-????-????????????-template-????????-????-????-????-????????????-versions'),
|
||||
], 'Removed 6 template objects across 3 key formats'),
|
||||
('service', [
|
||||
], 'Removed 6 objects across 3 key formats for template'),
|
||||
(['service', 'organisation'], [
|
||||
call('has_jobs-????????-????-????-????-????????????'),
|
||||
call('service-????????-????-????-????-????????????'),
|
||||
call('service-????????-????-????-????-????????????-templates'),
|
||||
@@ -762,16 +762,14 @@ def test_clear_cache_shows_form(
|
||||
call('service-????????-????-????-????-????????????-template-folders'),
|
||||
call('service-????????-????-????-????-????????????-returned-letters-statistics'),
|
||||
call('service-????????-????-????-????-????????????-returned-letters-summary'),
|
||||
], 'Removed 14 service objects across 7 key formats'),
|
||||
('organisation', [
|
||||
call('organisations'),
|
||||
call('domains'),
|
||||
call('live-service-and-organisation-counts'),
|
||||
call('organisation-????????-????-????-????-????????????-name'),
|
||||
], 'Removed 8 organisation objects across 4 key formats'),
|
||||
], 'Removed 22 objects across 11 key formats for service, organisation'),
|
||||
('broadcast', [
|
||||
call('service-????????-????-????-????-????????????-broadcast-message-????????-????-????-????-????????????'),
|
||||
], 'Removed 2 broadcast objects across 1 key formats'),
|
||||
], 'Removed 2 objects across 1 key formats for broadcast'),
|
||||
))
|
||||
def test_clear_cache_submits_and_tells_you_how_many_things_were_deleted(
|
||||
client_request,
|
||||
@@ -807,7 +805,7 @@ def test_clear_cache_requires_option(
|
||||
|
||||
page = client_request.post('main.clear_cache', _data={}, _expected_status=200)
|
||||
|
||||
assert normalize_spaces(page.find('span', class_='govuk-error-message').text) == 'Error: Select an option'
|
||||
assert normalize_spaces(page.find('span', class_='govuk-error-message').text) == 'Error: Select at least one option'
|
||||
assert not redis.delete_cache_keys_by_pattern.called
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user