@@ -648,6 +648,29 @@ def test_data_record_invalid_status_value():
648
648
assert e .value .args [0 ] == "UNSUPPORTED_STATUS"
649
649
650
650
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
+
651
674
@pytest .mark .parametrize ("idempotency_config" , [{"use_local_cache" : True }], indirect = True )
652
675
def test_in_progress_never_saved_to_cache (
653
676
idempotency_config : IdempotencyConfig , persistence_store : DynamoDBPersistenceLayer
0 commit comments