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
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ def _to_boto_request_value(self, request_value: Any, value_shape: Shape) -> Any:
elif isinstance(value_shape, StringShape) and not isinstance(request_value, str):
boto_request_value = to_json_str(request_value)
elif value_shape.type_name == "blob" and not isinstance(boto_request_value, bytes):
if not isinstance(boto_request_value, str):
boto_request_value = to_json_str(request_value, separators=(":", ","))
boto_request_value = to_json_str(request_value, separators=(",", ":"))
boto_request_value = to_bytes(boto_request_value)
return boto_request_value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
create_and_record_execution,
create_state_machine_with_iam_role,
)
from localstack.utils.strings import short_uid
from localstack.utils.strings import short_uid, to_str
from tests.aws.services.stepfunctions.templates.base.base_templates import BaseTemplate as BT
from tests.aws.services.stepfunctions.templates.services.services_templates import (
ServicesTemplates as ST,
Expand Down Expand Up @@ -310,13 +310,15 @@ def test_s3_put_object(
sfn_snapshot,
body,
):
file_key = f"file-key-{short_uid()}"
bucket_name = s3_create_bucket()
sfn_snapshot.add_transformer(RegexTransformer(file_key, "file-key"))
sfn_snapshot.add_transformer(RegexTransformer(bucket_name, "bucket-name"))

template = ST.load_sfn_template(ST.AWS_SDK_S3_PUT_OBJECT)
definition = json.dumps(template)

exec_input = json.dumps({"Bucket": bucket_name, "Key": "file-key", "Body": body})
exec_input = json.dumps({"Bucket": bucket_name, "Key": file_key, "Body": body})
create_and_record_execution(
aws_client,
create_state_machine_iam_role,
Expand All @@ -325,3 +327,7 @@ def test_s3_put_object(
definition,
exec_input,
)
get_object_response = aws_client.s3.get_object(Bucket=bucket_name, Key=file_key)
body = get_object_response["Body"].read()
body_str = to_str(body)
sfn_snapshot.match("s3-object-content-body", body_str)
Original file line number Diff line number Diff line change
Expand Up @@ -2348,7 +2348,7 @@
}
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[str]": {
"recorded-date": "11-06-2024, 07:42:53",
"recorded-date": "13-12-2024, 15:20:04",
"recorded-content": {
"get_execution_history": {
"events": [
Expand Down Expand Up @@ -2465,11 +2465,12 @@
"HTTPHeaders": {},
"HTTPStatusCode": 200
}
}
},
"s3-object-content-body": "\"text data\""
}
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[dict]": {
"recorded-date": "11-06-2024, 07:43:09",
"recorded-date": "13-12-2024, 15:20:52",
"recorded-content": {
"get_execution_history": {
"events": [
Expand Down Expand Up @@ -2592,11 +2593,14 @@
"HTTPHeaders": {},
"HTTPStatusCode": 200
}
},
"s3-object-content-body": {
"Dict": "Value"
}
}
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[list]": {
"recorded-date": "11-06-2024, 07:43:26",
"recorded-date": "13-12-2024, 15:21:44",
"recorded-content": {
"get_execution_history": {
"events": [
Expand Down Expand Up @@ -2722,11 +2726,12 @@
"HTTPHeaders": {},
"HTTPStatusCode": 200
}
}
},
"s3-object-content-body": "[\"List\",\"Data\"]"
}
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[bool]": {
"recorded-date": "11-06-2024, 07:43:42",
"recorded-date": "13-12-2024, 15:22:31",
"recorded-content": {
"get_execution_history": {
"events": [
Expand Down Expand Up @@ -2843,11 +2848,12 @@
"HTTPHeaders": {},
"HTTPStatusCode": 200
}
}
},
"s3-object-content-body": "false"
}
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[num]": {
"recorded-date": "11-06-2024, 07:43:58",
"recorded-date": "13-12-2024, 15:23:18",
"recorded-content": {
"get_execution_history": {
"events": [
Expand Down Expand Up @@ -2964,7 +2970,8 @@
"HTTPHeaders": {},
"HTTPStatusCode": 200
}
}
},
"s3-object-content-body": "0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
"last_validated_date": "2024-05-23T19:11:47+00:00"
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[bool]": {
"last_validated_date": "2024-06-11T07:43:42+00:00"
"last_validated_date": "2024-12-13T15:22:31+00:00"
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[dict]": {
"last_validated_date": "2024-06-11T07:43:09+00:00"
"last_validated_date": "2024-12-13T15:20:52+00:00"
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[list]": {
"last_validated_date": "2024-06-11T07:43:26+00:00"
"last_validated_date": "2024-12-13T15:21:44+00:00"
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[num]": {
"last_validated_date": "2024-06-11T07:43:58+00:00"
"last_validated_date": "2024-12-13T15:23:18+00:00"
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_s3_put_object[str]": {
"last_validated_date": "2024-06-11T07:42:53+00:00"
"last_validated_date": "2024-12-13T15:20:04+00:00"
},
"tests/aws/services/stepfunctions/v2/services/test_aws_sdk_task_service.py::TestTaskServiceAwsSdk::test_sfn_send_task_outcome_with_no_such_token[state_machine_template0]": {
"last_validated_date": "2024-04-10T18:55:26+00:00"
Expand Down
Loading