Fix SQS send_message_batch empty array Exception handling
This commit is contained in:
parent
4af10fe56b
commit
1431348161
@ -285,6 +285,9 @@ class SQSResponse(BaseResponse):
|
||||
"MessageAttributes": message_attributes,
|
||||
}
|
||||
|
||||
if entries == {}:
|
||||
raise EmptyBatchRequest()
|
||||
|
||||
messages = self.sqs_backend.send_message_batch(queue_name, entries)
|
||||
|
||||
template = self.response_template(SEND_MESSAGE_BATCH_RESPONSE)
|
||||
|
@ -1147,6 +1147,21 @@ def test_send_message_batch_errors():
|
||||
)
|
||||
|
||||
|
||||
@mock_sqs
|
||||
def test_send_message_batch_with_empty_list():
|
||||
client = boto3.client("sqs", region_name="us-east-1")
|
||||
|
||||
response = client.create_queue(QueueName="test-queue")
|
||||
queue_url = response["QueueUrl"]
|
||||
|
||||
client.send_message_batch.when.called_with(
|
||||
QueueUrl=queue_url, Entries=[]
|
||||
).should.throw(
|
||||
ClientError,
|
||||
"There should be at least one SendMessageBatchRequestEntry in the request.",
|
||||
)
|
||||
|
||||
|
||||
@mock_sqs
|
||||
def test_batch_change_message_visibility():
|
||||
if os.environ.get("TEST_SERVER_MODE", "false").lower() == "true":
|
||||
|
Loading…
Reference in New Issue
Block a user