Skip to content

Commit b98b5ec

Browse files
author
Michael Brewer
committed
chore: Correct docs for test
1 parent 88a0a93 commit b98b5ec

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

tests/functional/idempotency/test_idempotency.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -777,25 +777,23 @@ def test_custom_jmespath_function_overrides_builtin_functions(
777777
persistence_store._get_hashed_idempotency_key({})
778778

779779

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
788783
stubber = stub.Stubber(persistence_store.table.meta.client)
789-
stubber.add_client_error("put_item", "ClientError")
784+
stubber.add_client_error("put_item", "ResourceNotFoundException")
790785
stubber.activate()
791786

792-
@idempotent(config=config_with_validation, persistence_store=persistence_store)
787+
@idempotent(persistence_store=persistence_store)
793788
def lambda_handler(event, context):
794789
return {}
795790

791+
# WHEN handling the idempotent call
792+
# AND save_inprogress raises a ClientError
796793
with pytest.raises(IdempotencyPersistenceLayerError) as e:
797794
lambda_handler({}, {})
798795

796+
# THEN idempotent should raise an IdempotencyPersistenceLayerError
799797
stubber.assert_no_pending_responses()
800798
stubber.deactivate()
801799
assert "Failed to save in progress record to idempotency store" == e.value.args[0]

0 commit comments

Comments
 (0)