@@ -777,25 +777,23 @@ def test_custom_jmespath_function_overrides_builtin_functions(
777
777
persistence_store ._get_hashed_idempotency_key ({})
778
778
779
779
780
- @pytest .mark .parametrize ("config_with_validation" , [{"use_local_cache" : False }], indirect = True )
781
- def test_idempotent_lambda_save_inprogress_error (
782
- config_with_validation : IdempotencyConfig , persistence_store : DynamoDBPersistenceLayer
783
- ):
784
- """
785
- Test idempotent decorator where event with matching event key has already been successfully processed
786
- """
787
-
780
+ def test_idempotent_lambda_save_inprogress_error (persistence_store : DynamoDBPersistenceLayer ):
781
+ # GIVEN a miss configured persistence layer
782
+ # like no table was created for the idempotency persistence layer
788
783
stubber = stub .Stubber (persistence_store .table .meta .client )
789
- stubber .add_client_error ("put_item" , "ClientError " )
784
+ stubber .add_client_error ("put_item" , "ResourceNotFoundException " )
790
785
stubber .activate ()
791
786
792
- @idempotent (config = config_with_validation , persistence_store = persistence_store )
787
+ @idempotent (persistence_store = persistence_store )
793
788
def lambda_handler (event , context ):
794
789
return {}
795
790
791
+ # WHEN handling the idempotent call
792
+ # AND save_inprogress raises a ClientError
796
793
with pytest .raises (IdempotencyPersistenceLayerError ) as e :
797
794
lambda_handler ({}, {})
798
795
796
+ # THEN idempotent should raise an IdempotencyPersistenceLayerError
799
797
stubber .assert_no_pending_responses ()
800
798
stubber .deactivate ()
801
799
assert "Failed to save in progress record to idempotency store" == e .value .args [0 ]
0 commit comments