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 = [