Skip to main content

py-mockserver

mockserver client for james bloom's mockserver https://github.com/jamesdbloom/mockserver

Build Status

installation

pip install py-mockserver

Usage

For detail instruction how to use mockserver see this documentation

Creating Expectations

from pymockserver import Client, Request, Response
from pymockserver import RequestTimes

# without times
def create_expectation(self):
    client = Client('localhost', 1080)
	request = Request('/somepath', 'POST')
	response = Response('')
	client.expectation(request, response)

# with times
def create_expectation(self):
    client = Client('localhost', 1080)
	request = Request('/somepath', 'POST')
	response = Response('')
    times = Times()
	client.expectation(request, response, times)

RequestTimes is optional to specify if you don't want that fake endpoint to live forever

Getting recorded requests

from pymockserver import Client, Request

# get all recorded requests
client = Client('localhost', 1080)

def get_all_recorded():
   requests = client.retrieve_requests()
   # do something with array requests

def get_recorded_request_match():
    request = Request('/hello', 'POST')
    requests = client.retrieve_requests(request)

Examples

all other examples can be seen in integration_test.py

Metadata

Release files for py-mockserver 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-mockserver 0.1.6
File Size Uploaded
py-mockserver-0.1.6.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-mockserver 0.1.6
File Interpreter ABI Platform
py_mockserver-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / py-mockserver-0.1.6.tar.gz

Download URL py-mockserver-0.1.6.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b0820807337b583dce2af2cb3894a980140bb38f52b29451008edf91cd752e69
BLAKE2b-256 checksum
How to use checksums
f1537bafb4a49e09b1b86e76f3f5a2df2f5fb21e6cd2706ae21d28159b209191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / py_mockserver-0.1.6-py3-none-any.whl

Download URL py_mockserver-0.1.6-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67a8785e0e4caf9eaa5c6cab2f766357ac39e90aeba6c845cf5759fed2c87299
BLAKE2b-256 checksum
How to use checksums
e4655e55712d0ead8f6b08777fc4c5c6057050ed4893f76f276ff25c32f0c709
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

1 release file

0.1.4

2 release files

0.1.2

1 release file

0.1.1

2 release files

0.1

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page