SQS - get_queue_attributes() might not have AttributeNames-parameter (#4236)
This commit is contained in:
parent
532386327d
commit
ec70d3cd14
@ -642,6 +642,8 @@ class SQSBackend(BaseBackend):
|
||||
|
||||
def get_queue_attributes(self, queue_name, attribute_names):
|
||||
queue = self.get_queue(queue_name)
|
||||
if not attribute_names:
|
||||
return {}
|
||||
|
||||
valid_names = (
|
||||
["All"]
|
||||
|
@ -1253,6 +1253,21 @@ def test_fifo_send_receive_message_with_attribute_name(attribute_name, expected)
|
||||
expected["SequenceNumber"](message["Attributes"].get("SequenceNumber"))
|
||||
|
||||
|
||||
@mock_sqs
|
||||
def test_get_queue_attributes_no_param():
|
||||
"""
|
||||
AWS does not return the Attributes-key when omitting the AttributeNames-parameter
|
||||
"""
|
||||
sqs = boto3.client("sqs", region_name="ap-northeast-3")
|
||||
queue_url = sqs.create_queue(QueueName="test-queue")["QueueUrl"]
|
||||
|
||||
queue_attrs = sqs.get_queue_attributes(QueueUrl=queue_url)
|
||||
queue_attrs.shouldnt.have.key("Attributes")
|
||||
|
||||
queue_attrs = sqs.get_queue_attributes(QueueUrl=queue_url, AttributeNames=["All"])
|
||||
queue_attrs.should.have.key("Attributes")
|
||||
|
||||
|
||||
@mock_sqs
|
||||
def test_max_number_of_messages_invalid_param():
|
||||
sqs = boto3.resource("sqs", region_name="us-east-1")
|
||||
|
Loading…
Reference in New Issue
Block a user