Skip to main content

Serve WireMock stubs as a mock with respx.

Project description

Build Status PyPI

wiremock-mock

Serve WireMock stubs as a mock with respx.

Requires Python 3.12+.

Installation

uv pip install wiremock-mock

Or with pip:

pip install wiremock-mock

Usage

"""Example usage of wiremock-mock."""

from http import HTTPStatus
from typing import Any

import httpx
import respx

from wiremock_mock import add_wiremock_to_respx

stubs: dict[str, Any] = {
    "mappings": [
        {
            "request": {"method": "GET", "urlPath": "/v1/pages"},
            "response": {
                "status": 200,
                "jsonBody": {"object": "list", "results": []},
            },
        },
    ],
}
with respx.mock(
    base_url="http://notion-mock.test", assert_all_called=False
) as m:
    add_wiremock_to_respx(
        mock_obj=m, stubs=stubs, base_url="http://notion-mock.test"
    )
    response = httpx.get(url="http://notion-mock.test/v1/pages")
    assert response.status_code == HTTPStatus.OK  # noqa: S101

This lets you use existing WireMock stub files (e.g. from the WireMock Admin API import format) without running WireMock in Docker. All HTTP traffic is mocked at the httpx level via respx. To load stubs from a JSON file, use json.loads(path.read_text()).

Supported stub features

  • Request matching: method, urlPath (exact), urlPathPattern (regex)

  • Query parameters: queryParameters with equalTo

  • Response: status, headers, jsonBody, body

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wiremock_mock-2026.3.2.1.tar.gz (110.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wiremock_mock-2026.3.2.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file wiremock_mock-2026.3.2.1.tar.gz.

File metadata

  • Download URL: wiremock_mock-2026.3.2.1.tar.gz
  • Upload date:
  • Size: 110.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wiremock_mock-2026.3.2.1.tar.gz
Algorithm Hash digest
SHA256 3c51c3b29e2ca1b516fec0bb4b7494e6b73094721ce93b62048a021af9cbb87d
MD5 9b981cb3aab87f38f6edddb1922ef0c1
BLAKE2b-256 1bbdc14a60f1cbd90e833412ff05a6dd41eb9f7e2cf7df19c624555d35b3cbb8

See more details on using hashes here.

Provenance

The following attestation bundles were made for wiremock_mock-2026.3.2.1.tar.gz:

Publisher: release.yml on adamtheturtle/wiremock-mock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wiremock_mock-2026.3.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for wiremock_mock-2026.3.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31febada1b383c8a967f9e5c05930e1caff3d4339a13b44715e70bf00be54c73
MD5 466de42241e640c906496a7c88010697
BLAKE2b-256 63ab59c287dc159d1ab373d91fe227ca0837154b6e7d9a271df1ae02e644c079

See more details on using hashes here.

Provenance

The following attestation bundles were made for wiremock_mock-2026.3.2.1-py3-none-any.whl:

Publisher: release.yml on adamtheturtle/wiremock-mock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page