Skip to content

Commit fd0c022

Browse files
committed
A few tweaks
1 parent db24490 commit fd0c022

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

README.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ Run the test with:
3131
(venv) $ pytest
3232
```
3333

34-
You'll see a pact file is generated by this consumer test at `tests/userclientservice-userservice.json`
34+
You'll see a pact file is generated by this consumer test at `tests/userserviceclient-userservice.json`
3535

3636
Then, fire up your server-side app and verify the provider works as expected:
3737
```
3838
(venv) $ python pact_python_demo/user-app.py
3939
(venv) $ pact-verifier --provider-base-url=http://localhost:5001 \
40-
--pact-url=tests/userclientservice-userservice.json \
40+
--pact-url=tests/userserviceclient-userservice.json \
4141
--provider-states-setup-url=http://localhost:5001/_pact/provider_states
4242
```
4343

@@ -54,13 +54,19 @@ It's accessible at http://127.0.0.1 with username 'pactbroker' and password 'pac
5454

5555
To run the test, this time pushing the generated pact into the broker with version '0.1' of UserServiceClient, use:
5656
```
57-
(venv) $ pytest --update-pact 0.1
57+
(venv) $ pytest --publish-pact 0.1
5858
```
5959

6060
The `tests/conftest.py` adds this custom option, and `tests/test_client` has code in the `pact` fixture to upload to the broker if the command line option was passed.
6161

6262

63-
Then, you can validate the provider (UserService) and push the result to the broker by running `./verify_pact.sh 0.2` -- which runs the same `pact-verifier` command as above but has additional args for pulling the pact file from the broker (instead of getting the .json locally) and pushing the verification result to the broker.
63+
Then, you can validate the provider (UserService) and push the result to the broker by running:
64+
```
65+
(venv) $ python pact_python_demo/user-app.py
66+
(venv) ./verify_pact.sh 0.2
67+
```
68+
69+
This runs the same `pact-verifier` command as above but has additional args for pulling the pact file from the broker (instead of getting the .json locally) and pushing the verification result to the broker.
6470

6571
Log in to the broker and take a look at the matrix. You will see that UserClientService version 0.1 has been verified against UserService version 0.2
6672

tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
def pytest_addoption(parser):
33
parser.addoption(
4-
"--publish-pact-ver", type=str, action="store",
4+
"--publish-pact", type=str, action="store",
55
help="Upload generated pact file to pact broker with version"
66
)

tests/test_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def pact(request):
6464
yield pact
6565
pact.stop_service()
6666

67-
version = request.config.getoption('--publish-pact-ver')
67+
version = request.config.getoption('--publish-pact')
6868
if not request.node.testsfailed and version:
6969
push_to_broker(version)
7070

0 commit comments

Comments
 (0)