Merge pull request #1008 from alphagov/deactivate-service

Deactivate service
This commit is contained in:
Leo Hemsted
2016-11-14 11:41:13 +00:00
committed by GitHub
8 changed files with 152 additions and 248 deletions

View File

@@ -1,11 +1,11 @@
from __future__ import unicode_literals
from flask import url_for
from notifications_python_client.notifications import NotificationsAPIClient
from notifications_python_client.base import BaseAPIClient
from app.utils import BrowsableItem
from app.notify_client import _attach_current_user
class ServiceAPIClient(NotificationsAPIClient):
class ServiceAPIClient(BaseAPIClient):
# Fudge assert in the super __init__ so
# we can set those variables later.
def __init__(self):
@@ -31,14 +31,6 @@ class ServiceAPIClient(NotificationsAPIClient):
data = _attach_current_user(data)
return self.post("/service", data)['data']['id']
def delete_service(self, service_id):
"""
Delete a service.
"""
endpoint = "/service/{0}".format(service_id)
data = _attach_current_user({})
return self.delete(endpoint, data)
def get_service(self, service_id):
return self._get_service(service_id, detailed=False, today_only=False)
@@ -105,6 +97,9 @@ class ServiceAPIClient(NotificationsAPIClient):
def update_service_with_properties(self, service_id, properties):
return self.update_service(service_id, **properties)
def deactivate_service(self, service_id):
return self.post('/service/{}/deactivate'.format(service_id), data=None)
def remove_user_from_service(self, service_id, user_id):
"""
Remove a user from a service