Skip to content

Commit c9d1abd

Browse files
committed
chore: upgraded to specmatic python 2.26.1
Updated readme.
1 parent 6f1a413 commit c9d1abd

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class TestContract:
142142
(
143143
Specmatic()
144144
.with_specmatic_config_file_path(SPECMATIC_CONFIG_FILE_PATH)
145-
.with_stub(MOCK_HOST, MOCK_PORT, args=[f"--data={TEST_DATA_DIR}"])
145+
.with_mock(MOCK_HOST, MOCK_PORT, args=[f"--data={TEST_DATA_DIR}"])
146146
.with_asgi_app('app.main:app', APP_HOST, APP_PORT)
147147
.test_with_api_coverage_for_fastapi_app(TestContract, fastapi_app)
148148
.run()
@@ -161,7 +161,7 @@ os.environ["SPECMATIC_GENERATIVE_TESTS"] = "false"
161161
| **Specmatic configuration** | Points to your central `specmatic.yaml` file, which defines service contracts and dependencies. |
162162
| **Generative tests mode** | Enables Specmatic’s *generative testing* mode (`SPECMATIC_GENERATIVE_TESTS=true`) to generate resilience tests. |
163163
| **ASGI app registration** | `.with_asgi_app('app.main:app', APP_HOST, APP_PORT)` registers your FastAPI app for validation. Here, `app.main:app` refers to the `app` object inside the `main.py` module. |
164-
| **Mock registration** | `.with_stub(MOCK_HOST, MOCK_PORT, args=[f"--data={TEST_DATA_DIR}"])` launches the Specmatic mock locally to serve mock responses from the specified test data directory. |
164+
| **Mock registration** | `.with_mock(MOCK_HOST, MOCK_PORT, args=[f"--data={TEST_DATA_DIR}"])` launches the Specmatic mock locally to serve mock responses from the specified test data directory. |
165165
| **Contract testing with coverage** | `.test_with_api_coverage_for_fastapi_app(TestContract, fastapi_app)` runs Specmatic tests against your FastAPI app and reports API coverage by spinning up a lightweight coverage server (which parts of the contract were exercised). |
166166
| **Clean-up** | Once the tests complete, the environment variable is reset to disable generative testing. |
167167

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fastapi>=0.110
22
pytest>=7.4
33
python-dotenv>=1.0
4-
specmatic==2.24.0
4+
specmatic==2.26.1
55
redis==6.4.0
66
testcontainers==4.13.2
77
coverage==7.10.7

tests/contract/test_contract_fastapi.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
APP_HOST = "127.0.0.1"
1111
APP_PORT = 8000
1212

13-
STUB_HOST = "127.0.0.1"
14-
STUB_PORT = 8080
15-
STUB_DATA_DIR = ROOT_DIR + "tests/contract/data"
13+
MOCK_HOST = "127.0.0.1"
14+
MOCK_PORT = 8080
15+
TEST_DATA_DIR = ROOT_DIR + "tests/contract/data"
1616

1717
SPECMATIC_CONFIG_FILE_PATH = ROOT_DIR + '/specmatic.yaml'
1818

@@ -26,7 +26,7 @@ class TestContract:
2626
(
2727
Specmatic()
2828
.with_specmatic_config_file_path(SPECMATIC_CONFIG_FILE_PATH)
29-
.with_stub(STUB_HOST, STUB_PORT, args=[f"--data={STUB_DATA_DIR}"])
29+
.with_mock(MOCK_HOST, MOCK_PORT, args=[f"--data={TEST_DATA_DIR}"])
3030
.with_asgi_app('app.main:app', APP_HOST, APP_PORT)
3131
.test_with_api_coverage_for_fastapi_app(TestContract, fastapi_app)
3232
.run()

0 commit comments

Comments
 (0)