From 4e5a53f756d3bd3d596cc4c1f205364dea483041 Mon Sep 17 00:00:00 2001 From: Thomas Herve Date: Tue, 22 Sep 2015 15:23:34 +0200 Subject: [PATCH] Fix functional test of get_many_messages This fixes the test for retrieving several messages by IDs, which was previously not supported by falcon. Upgrading it fixes the behavior so we need to change the test as well. Change-Id: Icf355f9a6d667371a4f2b6077ca4954e1351e92d (cherry picked from commit bee843a033abf43b613a1a5146394c23cb064278) --- zaqarclient/tests/queues/queues.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/zaqarclient/tests/queues/queues.py b/zaqarclient/tests/queues/queues.py index 2739ed87..ad44b5d5 100644 --- a/zaqarclient/tests/queues/queues.py +++ b/zaqarclient/tests/queues/queues.py @@ -362,9 +362,17 @@ class QueuesV1QueueFunctionalTest(base.QueuesTestBase): msgs_id = [ref.split('/')[-1] for ref in res] messages = queue.messages(*msgs_id) self.assertTrue(isinstance(messages, iterator._Iterator)) - # FIXME(flaper87): Fix this as soon as we start - # sending `ids=1,2,3` to falcon - self.assertEqual(len(list(messages)), 1) + messages = list(messages) + length = len(messages) + if length == 3: + bodies = set(message.body for message in messages) + self.assertEqual( + set(['Post It 1!', 'Post It 2!', 'Post It 3!']), bodies) + elif length == 1: + # FIXME(therve): Old broken behavior, remove it as some point + pass + else: + self.fail("Wrong number of messages: '%d'" % length) def test_message_delete_many_functional(self): queue = self.client.queue("test_queue") @@ -381,8 +389,6 @@ class QueuesV1QueueFunctionalTest(base.QueuesTestBase): queue.delete_messages(*msgs_id) messages = queue.messages() - # FIXME(flaper87): Fix this as soon as we start - # sending `ids=1,2,3` to falcon self.assertEqual(len(list(messages)), 0)