From 45dd041fa7c7f9616bde604d1d88c868102a0d13 Mon Sep 17 00:00:00 2001 From: Malini Kamalambal Date: Mon, 1 Jul 2013 15:04:08 -0400 Subject: [PATCH] Fix Verification for Bulk Inserts. This fixes the verfication of message bodies returned, on a GET with multile message IDs in the URL Change-Id: Ieae9aeaebf92d773e4a744fad26599842fbb007c blueprint: system-tests --- marconi/tests/system/messages/test_messages.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/marconi/tests/system/messages/test_messages.py b/marconi/tests/system/messages/test_messages.py index 49b6016c0..a69af681b 100644 --- a/marconi/tests/system/messages/test_messages.py +++ b/marconi/tests/system/messages/test_messages.py @@ -53,7 +53,7 @@ class TestMessages(testtools.TestCase): self.assertEqual(result.status_code, 200) #Compare message metadata - result_body = result.json()['body'] + result_body = result.json()[0]['body'] posted_metadata = doc[0]['body'] self.assertEqual(result_body, posted_metadata) @@ -61,7 +61,8 @@ class TestMessages(testtools.TestCase): def test_002_message_bulk_insert(self): """Bulk Insert Messages into the Queue.""" - doc = msgfnlib.get_message_body(messagecount=30) + message_count = 30 + doc = msgfnlib.get_message_body(messagecount=message_count) url = self.cfg.base_url + '/queues/messagetestqueue/messages' result = http.post(url, self.header, doc) @@ -74,8 +75,14 @@ class TestMessages(testtools.TestCase): self.assertEqual(result.status_code, 200) #Compare message metadata - result_body = result.json()['body'] - posted_metadata = doc[0]['body'] + result_body = [result.json()['messages'][i]['body'] + for i in range(len(result.json()['messages']))] + result_body.sort() + + posted_metadata = [doc[i]['body'] + for i in range(message_count)] + posted_metadata.sort() + self.assertEqual(result_body, posted_metadata) test_002_message_bulk_insert.tags = ['smoke', 'positive']