mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Clear service cache for when updating org branding
Updating an organisation’s branding might now also update the branding of services associated to that organisation. This is similar to how updating an organisation’s type can update the organisation type for its services. In the latter case we already make sure to clear the cached version of these services which is held in Redis. This commit does the same clearing of the caches when updating an organisation’s branding (and does a bit of refactoring to do so without duplication of code.)
This commit is contained in:
@@ -361,6 +361,7 @@ def test_accept_agreement_page_validates(
|
||||
agreement_signed_version=1.2,
|
||||
agreement_signed_on_behalf_of_name='Firstname Lastname',
|
||||
agreement_signed_on_behalf_of_email_address='test@example.com',
|
||||
cached_service_ids=None,
|
||||
)
|
||||
),
|
||||
(
|
||||
@@ -375,6 +376,7 @@ def test_accept_agreement_page_validates(
|
||||
agreement_signed_version=1.2,
|
||||
agreement_signed_on_behalf_of_name='',
|
||||
agreement_signed_on_behalf_of_email_address='',
|
||||
cached_service_ids=None,
|
||||
)
|
||||
),
|
||||
(
|
||||
@@ -389,6 +391,7 @@ def test_accept_agreement_page_validates(
|
||||
agreement_signed_version=1.2,
|
||||
agreement_signed_on_behalf_of_name='',
|
||||
agreement_signed_on_behalf_of_email_address='',
|
||||
cached_service_ids=None,
|
||||
)
|
||||
),
|
||||
))
|
||||
@@ -483,6 +486,7 @@ def test_confirm_agreement_page_persists(
|
||||
agreement_signed=True,
|
||||
agreement_signed_at='2012-01-01 01:01:00',
|
||||
agreement_signed_by_id=fake_uuid,
|
||||
cached_service_ids=None,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -3196,6 +3196,7 @@ def test_service_preview_letter_branding_saves(
|
||||
client_request,
|
||||
platform_admin_user,
|
||||
mock_get_organisation,
|
||||
mock_get_organisation_services,
|
||||
mock_update_service,
|
||||
mock_update_organisation,
|
||||
mock_get_all_letter_branding,
|
||||
@@ -3229,6 +3230,11 @@ def test_service_preview_letter_branding_saves(
|
||||
mock_update_organisation.assert_called_once_with(
|
||||
ORGANISATION_ID,
|
||||
letter_branding_id=expected_post_data,
|
||||
cached_service_ids=[
|
||||
'12345',
|
||||
'67890',
|
||||
'596364a0-858e-42c8-9062-a8fe822260eb',
|
||||
],
|
||||
)
|
||||
assert mock_update_service.called is False
|
||||
|
||||
@@ -3407,6 +3413,7 @@ def test_should_set_branding_and_organisations(
|
||||
platform_admin_user,
|
||||
service_one,
|
||||
mock_get_organisation,
|
||||
mock_get_organisation_services,
|
||||
mock_update_service,
|
||||
mock_update_organisation,
|
||||
posted_value,
|
||||
@@ -3439,7 +3446,12 @@ def test_should_set_branding_and_organisations(
|
||||
elif endpoint == 'main.organisation_preview_email_branding':
|
||||
mock_update_organisation.assert_called_once_with(
|
||||
ORGANISATION_ID,
|
||||
email_branding_id=submitted_value
|
||||
email_branding_id=submitted_value,
|
||||
cached_service_ids=[
|
||||
'12345',
|
||||
'67890',
|
||||
'596364a0-858e-42c8-9062-a8fe822260eb',
|
||||
],
|
||||
)
|
||||
assert mock_update_service.called is False
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user