Merge "Revert "Change messaging clients to return one value and update tests""
diff --git a/tempest/api/messaging/base.py b/tempest/api/messaging/base.py
index c8dc5e0..eae0707 100644
--- a/tempest/api/messaging/base.py
+++ b/tempest/api/messaging/base.py
@@ -58,114 +58,114 @@
@classmethod
def create_queue(cls, queue_name):
"""Wrapper utility that returns a test queue."""
- body = cls.client.create_queue(queue_name)
- return body
+ resp, body = cls.client.create_queue(queue_name)
+ return resp, body
@classmethod
def delete_queue(cls, queue_name):
"""Wrapper utility that deletes a test queue."""
- body = cls.client.delete_queue(queue_name)
- return body
+ resp, body = cls.client.delete_queue(queue_name)
+ return resp, body
@classmethod
def check_queue_exists(cls, queue_name):
"""Wrapper utility that checks the existence of a test queue."""
- body = cls.client.get_queue(queue_name)
- return body
+ resp, body = cls.client.get_queue(queue_name)
+ return resp, body
@classmethod
def check_queue_exists_head(cls, queue_name):
"""Wrapper utility checks the head of a queue via http HEAD."""
- body = cls.client.head_queue(queue_name)
- return body
+ resp, body = cls.client.head_queue(queue_name)
+ return resp, body
@classmethod
def list_queues(cls):
"""Wrapper utility that lists queues."""
- body = cls.client.list_queues()
- return body
+ resp, body = cls.client.list_queues()
+ return resp, body
@classmethod
def get_queue_stats(cls, queue_name):
"""Wrapper utility that returns the queue stats."""
- body = cls.client.get_queue_stats(queue_name)
- return body
+ resp, body = cls.client.get_queue_stats(queue_name)
+ return resp, body
@classmethod
def get_queue_metadata(cls, queue_name):
"""Wrapper utility that gets a queue metadata."""
- body = cls.client.get_queue_metadata(queue_name)
- return body
+ resp, body = cls.client.get_queue_metadata(queue_name)
+ return resp, body
@classmethod
def set_queue_metadata(cls, queue_name, rbody):
"""Wrapper utility that sets the metadata of a queue."""
- body = cls.client.set_queue_metadata(queue_name, rbody)
- return body
+ resp, body = cls.client.set_queue_metadata(queue_name, rbody)
+ return resp, body
@classmethod
def post_messages(cls, queue_name, rbody):
"""Wrapper utility that posts messages to a queue."""
- body = cls.client.post_messages(queue_name, rbody)
+ resp, body = cls.client.post_messages(queue_name, rbody)
- return body
+ return resp, body
@classmethod
def list_messages(cls, queue_name):
"""Wrapper utility that lists the messages in a queue."""
- body = cls.client.list_messages(queue_name)
+ resp, body = cls.client.list_messages(queue_name)
- return body
+ return resp, body
@classmethod
def get_single_message(cls, message_uri):
"""Wrapper utility that gets a single message."""
- body = cls.client.get_single_message(message_uri)
+ resp, body = cls.client.get_single_message(message_uri)
- return body
+ return resp, body
@classmethod
def get_multiple_messages(cls, message_uri):
"""Wrapper utility that gets multiple messages."""
- body = cls.client.get_multiple_messages(message_uri)
+ resp, body = cls.client.get_multiple_messages(message_uri)
- return body
+ return resp, body
@classmethod
def delete_messages(cls, message_uri):
"""Wrapper utility that deletes messages."""
- body = cls.client.delete_messages(message_uri)
+ resp, body = cls.client.delete_messages(message_uri)
- return body
+ return resp, body
@classmethod
def post_claims(cls, queue_name, rbody, url_params=False):
"""Wrapper utility that claims messages."""
- body = cls.client.post_claims(
+ resp, body = cls.client.post_claims(
queue_name, rbody, url_params=False)
- return body
+ return resp, body
@classmethod
def query_claim(cls, claim_uri):
"""Wrapper utility that gets a claim."""
- body = cls.client.query_claim(claim_uri)
+ resp, body = cls.client.query_claim(claim_uri)
- return body
+ return resp, body
@classmethod
def update_claim(cls, claim_uri, rbody):
"""Wrapper utility that updates a claim."""
- body = cls.client.update_claim(claim_uri, rbody)
+ resp, body = cls.client.update_claim(claim_uri, rbody)
- return body
+ return resp, body
@classmethod
def release_claim(cls, claim_uri):
"""Wrapper utility that deletes a claim."""
- body = cls.client.release_claim(claim_uri)
+ resp, body = cls.client.release_claim(claim_uri)
- return body
+ return resp, body
@classmethod
def generate_message_body(cls, repeat=1):
diff --git a/tempest/api/messaging/test_claims.py b/tempest/api/messaging/test_claims.py
index ef5e4f7..c9064b0 100644
--- a/tempest/api/messaging/test_claims.py
+++ b/tempest/api/messaging/test_claims.py
@@ -49,14 +49,14 @@
claim_grace = data_utils.\
rand_int_id(start=60, end=CONF.messaging.max_claim_grace)
claim_body = {"ttl": claim_ttl, "grace": claim_grace}
- body = self.client.post_claims(queue_name=self.queue_name,
- rbody=claim_body)
+ resp, body = self.client.post_claims(queue_name=self.queue_name,
+ rbody=claim_body)
- return body
+ return resp, body
@test.attr(type='smoke')
def test_post_claim(self):
- body = self._post_and_claim_messages(queue_name=self.queue_name)
+ _, body = self._post_and_claim_messages(queue_name=self.queue_name)
claimed_message_uri = body[0]['href']
# Skipping this step till bug-1331517 is fixed
@@ -70,10 +70,10 @@
@test.attr(type='smoke')
def test_query_claim(self):
# Post a Claim
- body = self._post_and_claim_messages(queue_name=self.queue_name)
+ resp, body = self._post_and_claim_messages(queue_name=self.queue_name)
# Query Claim
- claim_uri = body.response['location']
+ claim_uri = resp['location']
self.client.query_claim(claim_uri)
# Delete Claimed message
@@ -84,9 +84,9 @@
@test.attr(type='smoke')
def test_update_claim(self):
# Post a Claim
- body = self._post_and_claim_messages(queue_name=self.queue_name)
+ resp, body = self._post_and_claim_messages(queue_name=self.queue_name)
- claim_uri = body.response['location']
+ claim_uri = resp['location']
claimed_message_uri = body[0]['href']
# Update Claim
@@ -97,7 +97,7 @@
self.client.update_claim(claim_uri, rbody=update_rbody)
# Verify claim ttl >= updated ttl value
- body = self.client.query_claim(claim_uri)
+ _, body = self.client.query_claim(claim_uri)
updated_claim_ttl = body["ttl"]
self.assertTrue(updated_claim_ttl >= claim_ttl)
@@ -107,8 +107,8 @@
@test.attr(type='smoke')
def test_release_claim(self):
# Post a Claim
- body = self._post_and_claim_messages(queue_name=self.queue_name)
- claim_uri = body.response['location']
+ resp, body = self._post_and_claim_messages(queue_name=self.queue_name)
+ claim_uri = resp['location']
# Release Claim
self.client.release_claim(claim_uri)
diff --git a/tempest/api/messaging/test_messages.py b/tempest/api/messaging/test_messages.py
index 2345e9e..dca95fc 100644
--- a/tempest/api/messaging/test_messages.py
+++ b/tempest/api/messaging/test_messages.py
@@ -36,18 +36,18 @@
def _post_messages(self, repeat=CONF.messaging.max_messages_per_page):
message_body = self.generate_message_body(repeat=repeat)
- body = self.post_messages(queue_name=self.queue_name,
- rbody=message_body)
- return body
+ resp, body = self.post_messages(queue_name=self.queue_name,
+ rbody=message_body)
+ return resp, body
@test.attr(type='smoke')
def test_post_messages(self):
# Post Messages
- resp = self._post_messages().response
+ resp, _ = self._post_messages()
# Get on the posted messages
message_uri = resp['location']
- resp = self.client.get_multiple_messages(message_uri).response
+ resp, _ = self.client.get_multiple_messages(message_uri)
# The test has an assertion here, because the response cannot be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('200', resp['status'])
@@ -58,7 +58,7 @@
self._post_messages()
# List Messages
- resp = self.list_messages(queue_name=self.queue_name).response
+ resp, _ = self.list_messages(queue_name=self.queue_name)
# The test has an assertion here, because the response cannot be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('200', resp['status'])
@@ -66,11 +66,11 @@
@test.attr(type='smoke')
def test_get_message(self):
# Post Messages
- body = self._post_messages()
+ _, body = self._post_messages()
message_uri = body['resources'][0]
# Get posted message
- resp = self.client.get_single_message(message_uri).response
+ resp, _ = self.client.get_single_message(message_uri)
# The test has an assertion here, because the response cannot be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('200', resp['status'])
@@ -78,11 +78,11 @@
@test.attr(type='smoke')
def test_get_multiple_messages(self):
# Post Messages
- resp = self._post_messages().response
+ resp, _ = self._post_messages()
message_uri = resp['location']
# Get posted messages
- resp = self.client.get_multiple_messages(message_uri).response
+ resp, _ = self.client.get_multiple_messages(message_uri)
# The test has an assertion here, because the response cannot be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('200', resp['status'])
@@ -90,14 +90,14 @@
@test.attr(type='smoke')
def test_delete_single_message(self):
# Post Messages
- body = self._post_messages()
+ _, body = self._post_messages()
message_uri = body['resources'][0]
# Delete posted message & verify the delete operration
self.client.delete_messages(message_uri)
message_uri = message_uri.replace('/messages/', '/messages?ids=')
- resp = self.client.get_multiple_messages(message_uri).response
+ resp, _ = self.client.get_multiple_messages(message_uri)
# The test has an assertion here, because the response has to be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('204', resp['status'])
@@ -105,12 +105,12 @@
@test.attr(type='smoke')
def test_delete_multiple_messages(self):
# Post Messages
- resp = self._post_messages().response
+ resp, _ = self._post_messages()
message_uri = resp['location']
# Delete multiple messages
self.client.delete_messages(message_uri)
- resp = self.client.get_multiple_messages(message_uri).response
+ resp, _ = self.client.get_multiple_messages(message_uri)
# The test has an assertion here, because the response has to be 204
# in this case (the client allows 200 or 204 for this API call).
self.assertEqual('204', resp['status'])
diff --git a/tempest/api/messaging/test_queues.py b/tempest/api/messaging/test_queues.py
index a8860f0..24656bf 100644
--- a/tempest/api/messaging/test_queues.py
+++ b/tempest/api/messaging/test_queues.py
@@ -33,7 +33,7 @@
def test_create_delete_queue(self):
# Create & Delete Queue
queue_name = data_utils.rand_name('test-')
- body = self.create_queue(queue_name)
+ _, body = self.create_queue(queue_name)
self.addCleanup(self.client.delete_queue, queue_name)
# NOTE(gmann): create_queue returns response status code as 201
@@ -74,7 +74,7 @@
@test.attr(type='smoke')
def test_list_queues(self):
# Listing queues
- body = self.list_queues()
+ _, body = self.list_queues()
self.assertEqual(len(body['queues']), len(self.queues))
for item in body['queues']:
self.assertIn(item['name'], self.queues)
@@ -85,7 +85,7 @@
queue_name = self.queues[data_utils.rand_int_id(0,
len(self.queues) - 1)]
# Get Queue Stats for a newly created Queue
- body = self.get_queue_stats(queue_name)
+ _, body = self.get_queue_stats(queue_name)
msgs = body['messages']
for element in ('free', 'claimed', 'total'):
self.assertEqual(0, msgs[element])
@@ -98,7 +98,7 @@
queue_name = self.queues[data_utils.rand_int_id(0,
len(self.queues) - 1)]
# Check the Queue has no metadata
- body = self.get_queue_metadata(queue_name)
+ _, body = self.get_queue_metadata(queue_name)
self.assertThat(body, matchers.HasLength(0))
# Create metadata
key3 = [0, 1, 2, 3, 4]
@@ -112,7 +112,7 @@
self.set_queue_metadata(queue_name, req_body)
# Get Queue Metadata
- body = self.get_queue_metadata(queue_name)
+ _, body = self.get_queue_metadata(queue_name)
self.assertThat(body, matchers.Equals(req_body))
@classmethod
diff --git a/tempest/services/messaging/json/messaging_client.py b/tempest/services/messaging/json/messaging_client.py
index 89aa87b..36444a9 100644
--- a/tempest/services/messaging/json/messaging_client.py
+++ b/tempest/services/messaging/json/messaging_client.py
@@ -50,51 +50,51 @@
if resp['status'] != '204':
body = json.loads(body)
self.validate_response(queues_schema.list_queues, resp, body)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def create_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.put(uri, body=None)
self.expected_success(201, resp.status)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def get_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.get(uri)
self.expected_success(204, resp.status)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def head_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.head(uri)
self.expected_success(204, resp.status)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def delete_queue(self, queue_name):
uri = '{0}/queues/{1}'.format(self.uri_prefix, queue_name)
resp, body = self.delete(uri)
self.expected_success(204, resp.status)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def get_queue_stats(self, queue_name):
uri = '{0}/queues/{1}/stats'.format(self.uri_prefix, queue_name)
resp, body = self.get(uri)
body = json.loads(body)
self.validate_response(queues_schema.queue_stats, resp, body)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def get_queue_metadata(self, queue_name):
uri = '{0}/queues/{1}/metadata'.format(self.uri_prefix, queue_name)
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def set_queue_metadata(self, queue_name, rbody):
uri = '{0}/queues/{1}/metadata'.format(self.uri_prefix, queue_name)
resp, body = self.put(uri, body=json.dumps(rbody))
self.expected_success(204, resp.status)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def post_messages(self, queue_name, rbody):
uri = '{0}/queues/{1}/messages'.format(self.uri_prefix, queue_name)
@@ -104,7 +104,7 @@
body = json.loads(body)
self.validate_response(queues_schema.post_messages, resp, body)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def list_messages(self, queue_name):
uri = '{0}/queues/{1}/messages?echo=True'.format(self.uri_prefix,
@@ -115,7 +115,7 @@
body = json.loads(body)
self.validate_response(queues_schema.list_messages, resp, body)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def get_single_message(self, message_uri):
resp, body = self.get(message_uri, extra_headers=True,
@@ -124,7 +124,7 @@
body = json.loads(body)
self.validate_response(queues_schema.get_single_message, resp,
body)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def get_multiple_messages(self, message_uri):
resp, body = self.get(message_uri, extra_headers=True,
@@ -136,12 +136,12 @@
resp,
body)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def delete_messages(self, message_uri):
resp, body = self.delete(message_uri)
self.expected_success(204, resp.status)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def post_claims(self, queue_name, rbody, url_params=False):
uri = '{0}/queues/{1}/claims'.format(self.uri_prefix, queue_name)
@@ -154,7 +154,7 @@
body = json.loads(body)
self.validate_response(queues_schema.claim_messages, resp, body)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def query_claim(self, claim_uri):
resp, body = self.get(claim_uri)
@@ -162,14 +162,14 @@
if resp['status'] != '204':
body = json.loads(body)
self.validate_response(queues_schema.query_claim, resp, body)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def update_claim(self, claim_uri, rbody):
resp, body = self.patch(claim_uri, body=json.dumps(rbody))
self.expected_success(204, resp.status)
- return service_client.ResponseBody(resp, body)
+ return resp, body
def release_claim(self, claim_uri):
resp, body = self.delete(claim_uri)
self.expected_success(204, resp.status)
- return service_client.ResponseBody(resp, body)
+ return resp, body