From d5af47dd45981839c85c813420d400c4c849f468 Mon Sep 17 00:00:00 2001 From: Devin Gaffney Date: Thu, 14 Nov 2024 21:02:40 -0800 Subject: [PATCH] CV2-5589 reverts accidental regression on structure of receive_messages which returns tuples, and changed as a result of moving to singular queue responses --- lib/queue/queue.py | 2 +- test/lib/queue/test_queue.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/queue/queue.py b/lib/queue/queue.py index 7394fe6..cb5b5b5 100644 --- a/lib/queue/queue.py +++ b/lib/queue/queue.py @@ -170,7 +170,7 @@ def receive_messages(self, batch_size: int = 1): Receive messages from a queue. """ queue = self.get_or_create_queue(self.input_queue_name)[0] - return queue.receive_messages(MaxNumberOfMessages=min(batch_size, SQS_MAX_BATCH_SIZE)) + return [(m, self.input_queue_name) for m in queue.receive_messages(MaxNumberOfMessages=min(batch_size, SQS_MAX_BATCH_SIZE))] def find_queue_by_name(self, queue_name: str) -> boto3.resources.base.ServiceResource: """ diff --git a/test/lib/queue/test_queue.py b/test/lib/queue/test_queue.py index 362bb2f..a56571b 100644 --- a/test/lib/queue/test_queue.py +++ b/test/lib/queue/test_queue.py @@ -125,8 +125,8 @@ def test_receive_messages(self): received_messages = self.queue.receive_messages(5) # Assertions self.assertEqual(len(received_messages), 2) - self.assertIn("a test", json.loads(received_messages[0].body)["body"]["text"]) - self.assertIn("another test", json.loads(received_messages[1].body)["body"]["text"]) + self.assertIn("a test", json.loads(received_messages[0][0].body)["body"]["text"]) + self.assertIn("another test", json.loads(received_messages[1][0].body)["body"]["text"]) def test_restrict_queues_by_suffix(self): queues = [