Clear user cache when deleting a service

The user JSON has a list of service IDs
This commit is contained in:
Chris Hill-Scott
2018-04-19 13:25:04 +01:00
parent 9a3f9b7273
commit 1c91e10d5d
3 changed files with 8 additions and 6 deletions
+1
View File
@@ -9,6 +9,7 @@ class ServiceAPIClient(NotifyAdminAPIClient):
def __init__(self): def __init__(self):
super().__init__("a" * 73, "b") super().__init__("a" * 73, "b")
@cache.delete('user', key_from_args=[4])
def create_service( def create_service(
self, self,
service_name, service_name,
@@ -58,12 +58,12 @@ def test_client_creates_service_with_correct_data(
mocker.patch('app.notify_client.current_user', id='123') mocker.patch('app.notify_client.current_user', id='123')
client.create_service( client.create_service(
service_name='My first service', 'My first service',
organisation_type='central_government', 'central_government',
message_limit=1, 1,
restricted=True, True,
user_id=fake_uuid, fake_uuid,
email_from='test@example.com', 'test@example.com',
) )
mock_post.assert_called_once_with( mock_post.assert_called_once_with(
'/service', '/service',
@@ -248,6 +248,7 @@ def test_returns_value_from_cache(
(user_api_client, 'set_user_permissions', [user_id, SERVICE_ONE_ID, []], {}), (user_api_client, 'set_user_permissions', [user_id, SERVICE_ONE_ID, []], {}),
(user_api_client, 'activate_user', [api_user_pending(fake_uuid())], {}), (user_api_client, 'activate_user', [api_user_pending(fake_uuid())], {}),
(service_api_client, 'remove_user_from_service', [SERVICE_ONE_ID, user_id], {}), (service_api_client, 'remove_user_from_service', [SERVICE_ONE_ID, user_id], {}),
(service_api_client, 'create_service', ['', '', 0, False, user_id, fake_uuid()], {}),
(invite_api_client, 'accept_invite', [SERVICE_ONE_ID, user_id], {}), (invite_api_client, 'accept_invite', [SERVICE_ONE_ID, user_id], {}),
]) ])
def test_deletes_user_cache( def test_deletes_user_cache(