Skip to content

Commit

Permalink
CV2-5589 reverts accidental regression on structure of receive_messag…
Browse files Browse the repository at this point in the history
…es which returns tuples, and changed as a result of moving to singular queue responses
  • Loading branch information
DGaffney committed Nov 15, 2024
1 parent 2e586e7 commit d5af47d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/queue/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down
4 changes: 2 additions & 2 deletions test/lib/queue/test_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit d5af47d

Please sign in to comment.