Commit a47de447 authored by Trond Aasan's avatar Trond Aasan
Browse files

CIM-27 Use entity specific function names

parent 0c5d1527
......@@ -10,8 +10,8 @@ c = CimClient(url='https://example.com',
delete_person_url='/_webservices/?ws=contacts/delete/1.0',
tokens={'api_key': {'X-Gravitee-API-Key': 'c-d-a-b'},})
upd_schema = c.get_update_schema()
del_schema = c.get_delete_schema()
upd_schema = c.get_update_person_schema()
del_schema = c.get_delete_person_schema()
person = Person.from_dict({'username': 'foo', 'user_import_id': 'foo1'})
response1 = c.update_person(person)
......
......@@ -71,10 +71,10 @@ class CimEndpoints:
def delete_person(self):
return urllib.parse.urljoin(self.baseurl, self.delete_person_url)
def get_update_schema(self):
def get_update_person_schema(self):
return urllib.parse.urljoin(self.baseurl, self.update_person_url)
def get_delete_schema(self):
def get_delete_person_schema(self):
return urllib.parse.urljoin(self.baseurl, self.delete_person_url)
......@@ -171,7 +171,7 @@ class CimClient(object):
return data
return cls.from_dict(data)
def get_update_schema(self):
def get_update_person_schema(self):
"""GETs the current schema from CIM
The schema can change depending on the installation.
......@@ -180,13 +180,13 @@ class CimClient(object):
checks whether the schema has changed lately so you don't update
using an outdated schema.
"""
url = self.urls.get_update_schema()
url = self.urls.get_update_person_schema()
response = self.get(url,
auth=self.auth,
headers=self.tokens.get('api_key', None))
return response.json()
def get_delete_schema(self):
def get_delete_person_schema(self):
"""GETs the current schema from CIM
The schema can change depending on the installation.
......@@ -195,7 +195,7 @@ class CimClient(object):
checks whether the schema has changed lately so you don't update
using an outdated schema.
"""
url = self.urls.get_delete_schema()
url = self.urls.get_delete_person_schema()
response = self.get(url,
auth=self.auth,
headers=self.tokens.get('api_key', None))
......
......@@ -43,19 +43,19 @@ def test_init_modify_defaults(client_cls, baseurl, header_name):
assert client.default_headers[header_name] != headers[header_name]
def test_get_update_schema(client, requests_mock):
def test_get_update_person_schema(client, requests_mock):
"""Ensure getting update schema works"""
requests_mock.get('https://localhost/_webservices/?ws=contacts/upsert/1.0',
json={'foo': 'bar'})
response = client.get_update_schema()
response = client.get_update_person_schema()
assert response == {'foo': 'bar'}
def test_get_delete_schema(client, requests_mock):
def test_get_delete_person_schema(client, requests_mock):
"""Ensure getting update schema works"""
requests_mock.get('https://localhost/_webservices/?ws=contacts/delete/1.0',
json={'foo': 'bar'})
response = client.get_delete_schema()
response = client.get_delete_person_schema()
assert response == {'foo': 'bar'}
......
......@@ -16,13 +16,13 @@ def test_delete_person(baseurl, endpoints):
assert url == baseurl + f'/_webservices/?ws=contacts/delete/1.0'
def test_get_update_schema(baseurl, endpoints):
url = endpoints.get_update_schema()
def test_get_update_person_schema(baseurl, endpoints):
url = endpoints.get_update_person_schema()
assert url == baseurl + f'/_webservices/?ws=contacts/upsert/1.0'
def test_get_delete_schema(baseurl, endpoints):
url = endpoints.get_delete_schema()
def test_get_delete_person_schema(baseurl, endpoints):
url = endpoints.get_delete_person_schema()
assert url == baseurl + f'/_webservices/?ws=contacts/delete/1.0'
......@@ -36,11 +36,11 @@ def test_custom_delete_person(custom_endpoints, baseurl):
baseurl + '/custom/_webservices/?ws=contacts/delete/1.0')
def test_custom_get_update_schema(custom_endpoints, baseurl):
assert (custom_endpoints.get_update_schema() ==
def test_custom_get_update_person_schema(custom_endpoints, baseurl):
assert (custom_endpoints.get_update_person_schema() ==
baseurl + '/custom/_webservices/?ws=contacts/upsert/1.0')
def test_custom_get_delete_schema(custom_endpoints, baseurl):
assert (custom_endpoints.get_delete_schema() ==
def test_custom_get_delete_person_schema(custom_endpoints, baseurl):
assert (custom_endpoints.get_delete_person_schema() ==
baseurl + '/custom/_webservices/?ws=contacts/delete/1.0')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment