Full response for v3 EndpointsClient methods
Provide the entire response object for all methods of the v3 EndpointsClient
partially implements: blueprint method-return-value-and-move-service-clients-to-lib
Change-Id: I9c695f783814b13f10625ca506ac80946c048763
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 9a8104f..6ec0884 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -44,8 +44,8 @@
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
- endpoint = cls.client.create_endpoint(
- cls.service_id, interface, url, region=region, enabled=True)
+ endpoint = (cls.client.create_endpoint(cls.service_id, interface,
+ url, region=region, enabled=True))['endpoint']
cls.setup_endpoints.append(endpoint)
@classmethod
@@ -59,7 +59,7 @@
@test.idempotent_id('c19ecf90-240e-4e23-9966-21cee3f6a618')
def test_list_endpoints(self):
# Get a list of endpoints
- fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()['endpoints']
# Asserting LIST endpoints
missing_endpoints =\
[e for e in self.setup_endpoints if e not in fetched_endpoints]
@@ -72,21 +72,20 @@
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
- endpoint =\
- self.client.create_endpoint(self.service_id, interface, url,
- region=region, enabled=True)
+ endpoint = (self.client.create_endpoint(self.service_id, interface,
+ url, region=region, enabled=True)['endpoint'])
# Asserting Create Endpoint response body
self.assertIn('id', endpoint)
self.assertEqual(region, endpoint['region'])
self.assertEqual(url, endpoint['url'])
# Checking if created endpoint is present in the list of endpoints
- fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()['endpoints']
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertIn(endpoint['id'], fetched_endpoints_id)
# Deleting the endpoint created in this method
self.client.delete_endpoint(endpoint['id'])
# Checking whether endpoint is deleted successfully
- fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()['endpoints']
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertNotIn(endpoint['id'], fetched_endpoints_id)
@@ -101,7 +100,7 @@
endpoint_for_update =\
self.client.create_endpoint(self.service_id, interface1,
url1, region=region1,
- enabled=True)
+ enabled=True)['endpoint']
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
# Creating service so as update endpoint with new service ID
s_name = data_utils.rand_name('service')
@@ -119,7 +118,8 @@
self.client.update_endpoint(endpoint_for_update['id'],
service_id=service2['id'],
interface=interface2, url=url2,
- region=region2, enabled=False)
+ region=region2,
+ enabled=False)['endpoint']
# Asserting if the attributes of endpoint are updated
self.assertEqual(service2['id'], endpoint['service_id'])
self.assertEqual(interface2, endpoint['interface'])
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index b043415..d1828a0 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -78,7 +78,8 @@
interface1 = 'public'
endpoint_for_update = (
self.client.create_endpoint(self.service_id, interface1,
- url1, region=region1, enabled=True))
+ url1, region=region1,
+ enabled=True))['endpoint']
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
self.assertRaises(lib_exc.BadRequest, self.client.update_endpoint,
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index f93fb74..6bdf8b3 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -26,7 +26,7 @@
resp, body = self.get('endpoints')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['endpoints'])
+ return service_client.ResponseBody(resp, body)
def create_endpoint(self, service_id, interface, url, **kwargs):
"""Create endpoint.
@@ -51,7 +51,7 @@
resp, body = self.post('endpoints', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['endpoint'])
+ return service_client.ResponseBody(resp, body)
def update_endpoint(self, endpoint_id, service_id=None, interface=None,
url=None, region=None, enabled=None, **kwargs):
@@ -78,7 +78,7 @@
resp, body = self.patch('endpoints/%s' % endpoint_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['endpoint'])
+ return service_client.ResponseBody(resp, body)
def delete_endpoint(self, endpoint_id):
"""Delete endpoint."""