Delete caches when user accepts invite

Accepting an invite changes:
- the `user_to_service` list of users returned by `GET /service/<id>`
- the `services` list return by `GET /user/<id>`

The latter change is causing the functional tests to fail.
This commit is contained in:
Chris Hill-Scott
2018-04-19 13:15:52 +01:00
parent b849e214fd
commit 9a3f9b7273
3 changed files with 7 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
from app.notify_client import NotifyAdminAPIClient, _attach_current_user
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
from app.notify_client.models import (
InvitedUser,
translate_permissions_from_admin_roles_to_db,
@@ -44,6 +44,8 @@ class InviteApiClient(NotifyAdminAPIClient):
self.post(url='/service/{0}/invite/{1}'.format(service_id, invited_user_id),
data=data)
@cache.delete('service')
@cache.delete('user', key_from_args=[1])
def accept_invite(self, service_id, invited_user_id):
data = {'status': 'accepted'}
self.post(url='/service/{0}/invite/{1}'.format(service_id, invited_user_id),