Skip to content

Commit 20ce752

Browse files
author
Michal Ploski
committed
Add missing tests
1 parent 862c67e commit 20ce752

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/functional/idempotency/test_idempotency.py

+23
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,29 @@ def test_data_record_invalid_status_value():
648648
assert e.value.args[0] == "UNSUPPORTED_STATUS"
649649

650650

651+
def test_data_record_json_to_dict_mapping():
652+
# GIVEN a data record with status "COMPLETED" and provided response data
653+
data_record = DataRecord(
654+
"key", status="INPROGRESS", response_data='{"body": "execution finished","statusCode": "200"}'
655+
)
656+
657+
# WHEN translating response data to dictionary
658+
response_data = data_record.response_json_as_dict()
659+
660+
# THEN return dictionary
661+
assert isinstance(response_data, dict)
662+
663+
664+
def test_data_record_json_to_dict_mapping_when_response_data_none():
665+
# GIVEN a data record with status "INPROGRESS" and not set response data
666+
data_record = DataRecord("key", status="INPROGRESS", response_data=None)
667+
# WHEN translating response data to dictionary
668+
response_data = data_record.response_json_as_dict()
669+
670+
# THEN return null value
671+
assert response_data is None
672+
673+
651674
@pytest.mark.parametrize("idempotency_config", [{"use_local_cache": True}], indirect=True)
652675
def test_in_progress_never_saved_to_cache(
653676
idempotency_config: IdempotencyConfig, persistence_store: DynamoDBPersistenceLayer

0 commit comments

Comments
 (0)