From 15507c84473565b8dc7127dbc19179c31647fa4a Mon Sep 17 00:00:00 2001 From: Artur Neumann Date: Mon, 7 Oct 2024 15:23:17 +0545 Subject: [PATCH] fix(examples): do not overwrite pact file on every test the overwrite caused only the last test-case to be saved as interaction in the pact JSON file --- examples/tests/v3/test_00_consumer.py | 2 +- examples/tests/v3/test_01_fastapi_provider.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tests/v3/test_00_consumer.py b/examples/tests/v3/test_00_consumer.py index 2807d1fc4..8ff7dca8a 100644 --- a/examples/tests/v3/test_00_consumer.py +++ b/examples/tests/v3/test_00_consumer.py @@ -49,7 +49,7 @@ def pact() -> Generator[Pact, None, None]: pact_dir = Path(Path(__file__).parent.parent.parent / "pacts") pact = Pact("v3_http_consumer", "v3_http_provider") yield pact.with_specification("V4") - pact.write_file(pact_dir, overwrite=True) + pact.write_file(pact_dir) def test_get_existing_user(pact: Pact) -> None: diff --git a/examples/tests/v3/test_01_fastapi_provider.py b/examples/tests/v3/test_01_fastapi_provider.py index c998488f6..0be73f6d8 100644 --- a/examples/tests/v3/test_01_fastapi_provider.py +++ b/examples/tests/v3/test_01_fastapi_provider.py @@ -340,7 +340,7 @@ def verify_mock_post_request_to_create_user() -> None: if TYPE_CHECKING: examples.src.fastapi.FAKE_DB = MagicMock() - assert len(examples.src.fastapi.FAKE_DB.mock_calls) == 2 + assert len(examples.src.fastapi.FAKE_DB.mock_calls) == 3 examples.src.fastapi.FAKE_DB.__getitem__.assert_called_once() args, kwargs = examples.src.fastapi.FAKE_DB.__getitem__.call_args