Skip to content

Commit 0e4a174

Browse files
JP-Ellisvalkolovos
andcommitted
chore(tests): implement v3/v4 consumer message compatibility suite
Co-authored-by: valkolovos <[email protected]> Co-authored-by: JP-Ellis <[email protected]> Signed-off-by: JP-Ellis <[email protected]>
1 parent 42654ba commit 0e4a174

File tree

6 files changed

+891
-24
lines changed

6 files changed

+891
-24
lines changed

tests/v3/compatibility_suite/test_v3_consumer.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pytest_bdd import given, parsers, scenario, then
1111

1212
from pact.v3.pact import HttpInteraction, Pact
13-
from tests.v3.compatibility_suite.util import parse_markdown_table
13+
from tests.v3.compatibility_suite.util import PactInteractionTuple, parse_markdown_table
1414
from tests.v3.compatibility_suite.util.consumer import (
1515
the_pact_file_for_the_test_is_generated,
1616
)
@@ -48,21 +48,21 @@ def test_supports_data_for_provider_states() -> None:
4848
target_fixture="pact_interaction",
4949
)
5050
def an_integration_is_being_defined_for_a_consumer_test() -> (
51-
Generator[tuple[Pact, HttpInteraction], Any, None]
51+
Generator[PactInteractionTuple[HttpInteraction], Any, None]
5252
):
5353
"""An integration is being defined for a consumer test."""
5454
pact = Pact("consumer", "provider")
5555
pact.with_specification("V3")
56-
yield (pact, pact.upon_receiving("a request"))
56+
yield PactInteractionTuple(pact, pact.upon_receiving("a request"))
5757

5858

5959
@given(parsers.re(r'a provider state "(?P<state>[^"]+)" is specified'))
6060
def a_provider_state_is_specified(
61-
pact_interaction: tuple[Pact, HttpInteraction],
61+
pact_interaction: PactInteractionTuple[HttpInteraction],
6262
state: str,
6363
) -> None:
6464
"""A provider state is specified."""
65-
pact_interaction[1].given(state)
65+
pact_interaction.interaction.given(state)
6666

6767

6868
@given(
@@ -74,7 +74,7 @@ def a_provider_state_is_specified(
7474
converters={"table": parse_markdown_table},
7575
)
7676
def a_provider_state_is_specified_with_the_following_data(
77-
pact_interaction: tuple[Pact, HttpInteraction],
77+
pact_interaction: PactInteractionTuple[HttpInteraction],
7878
state: str,
7979
table: list[dict[str, Any]],
8080
) -> None:
@@ -93,7 +93,7 @@ def a_provider_state_is_specified_with_the_following_data(
9393
elif value.replace(".", "", 1).isdigit():
9494
row[key] = float(value)
9595

96-
pact_interaction[1].given(state, parameters=table[0])
96+
pact_interaction.interaction.given(state, parameters=table[0])
9797

9898

9999
################################################################################

0 commit comments

Comments
 (0)