Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions localstack-core/localstack/services/sqs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,9 +748,9 @@ def put(
f"Value {message_deduplication_id} for parameter MessageDeduplicationId is invalid. Reason: The "
f"request includes a parameter that is not valid for this queue type."
)
if message_group_id:
if isinstance(message_group_id, str):
raise InvalidParameterValueException(
f"Value {message_group_id} for parameter MessageGroupId is invalid. Reason: The request includes a "
f"Value {message_group_id} for parameter MessageGroupId is invalid. Reason: The request include "
f"parameter that is not valid for this queue type."
)

Expand Down
10 changes: 10 additions & 0 deletions tests/aws/services/sqs/test_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,16 @@ def test_send_message_batch_with_oversized_contents_with_updated_maximum_message

snapshot.match("send_oversized_message_batch", response)

@markers.aws.validated
def test_send_message_to_standard_queue_with_empty_message_group_id(
self, sqs_create_queue, aws_client, snapshot
):
queue = sqs_create_queue()

with pytest.raises(ClientError) as e:
aws_client.sqs.send_message(QueueUrl=queue, MessageBody="message", MessageGroupId="")
snapshot.match("error-response", e.value.response)

@markers.aws.validated
def test_tag_untag_queue(self, sqs_create_queue, aws_sqs_client, snapshot):
queue_url = sqs_create_queue()
Expand Down
17 changes: 17 additions & 0 deletions tests/aws/services/sqs/test_sqs.snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,23 @@
}
}
},
"tests/aws/services/sqs/test_sqs.py::TestSqsProvider::test_send_message_to_standard_queue_with_empty_message_group_id": {
"recorded-date": "08-11-2024, 12:04:39",
"recorded-content": {
"error-response": {
"Error": {
"Code": "InvalidParameterValue",
"Message": "Value for parameter MessageGroupId is invalid. Reason: The request include parameter that is not valid for this queue type.",
"QueryErrorCode": "InvalidParameterValueException",
"Type": "Sender"
},
"ResponseMetadata": {
"HTTPHeaders": {},
"HTTPStatusCode": 400
}
}
}
},
"tests/aws/services/sqs/test_sqs.py::TestSqsProvider::test_send_batch_missing_message_group_id_for_fifo_queue[sqs_query]": {
"recorded-date": "30-04-2024, 13:33:45",
"recorded-content": {
Expand Down
3 changes: 3 additions & 0 deletions tests/aws/services/sqs/test_sqs.validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@
"tests/aws/services/sqs/test_sqs.py::TestSqsProvider::test_send_message_batch_with_oversized_contents_with_updated_maximum_message_size[sqs_query]": {
"last_validated_date": "2024-04-30T13:33:10+00:00"
},
"tests/aws/services/sqs/test_sqs.py::TestSqsProvider::test_send_message_to_standard_queue_with_empty_message_group_id": {
"last_validated_date": "2024-11-08T12:08:17+00:00"
},
"tests/aws/services/sqs/test_sqs.py::TestSqsProvider::test_send_message_with_binary_attributes[sqs]": {
"last_validated_date": "2024-04-30T13:33:48+00:00"
},
Expand Down
Loading