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.tar.gz (110.8 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-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wiremock_mock-2026.3.2.tar.gz
  • Upload date:
  • Size: 110.8 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.tar.gz
Algorithm Hash digest
SHA256 90884e7afe66a71ecafd31a51d09a74910c0b5181cbc9aa9cba9c2e035dfc31d
MD5 a4168e0536b7baa18ad4d9b8be141547
BLAKE2b-256 bb213aedb14151b0d89a434604ea5c2ddd0ee20fcbc1fd68eba6b81718e92ca2

See more details on using hashes here.

Provenance

The following attestation bundles were made for wiremock_mock-2026.3.2.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-py3-none-any.whl.

File metadata

File hashes

Hashes for wiremock_mock-2026.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 532e5f9cde58c020d9ca34017125e99947afecb3c69cb151ce3d27b364038aec
MD5 989213a629ae04ee2d2b0eda1b767d28
BLAKE2b-256 72068bbf5fb660e5df2a37cb7064cc477b762b33ce5fd359e60ecb3ebb789140

See more details on using hashes here.

Provenance

The following attestation bundles were made for wiremock_mock-2026.3.2-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