- Change update service name to check that the name/email_from is unique across all services.

- This is done using a new endpoint in the api.
- Removed the AddServiceForm in favor or using the ServiceNameForm
- Removed ServiceApiClient.find_all_service_email_from
This commit is contained in:
Rebecca Law
2017-08-09 16:52:10 +01:00
parent 14be8dc463
commit 9b9c6d75dc
6 changed files with 29 additions and 37 deletions

View File

@@ -216,9 +216,13 @@ class ServiceAPIClient(NotifyAdminAPIClient):
data = _attach_current_user(data)
return self.post(endpoint, data=data)
def find_all_service_email_from(self, user_id=None):
resp = self.get_services(user_id)
return [x['email_from'] for x in resp['data']]
def is_service_name_unique(self, name, email_from):
"""
Check that the service name or email from are unique across all services.
"""
endpoint = "/service/unique"
params = {"name": name, "email_from": email_from}
return self.get(url=endpoint, params=params)["result"]
# Temp access of service history data. Includes service and api key history
def get_service_history(self, service_id):