Python client for mockserver
Project description
py-mockserver
mockserver client for james bloom's mockserver https://github.com/jamesdbloom/mockserver
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py-mockserver-0.1.6.tar.gz.
File metadata
- Download URL: py-mockserver-0.1.6.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0820807337b583dce2af2cb3894a980140bb38f52b29451008edf91cd752e69
|
|
| MD5 |
a4bc02b89c90830182a923a29ad6a13f
|
|
| BLAKE2b-256 |
f1537bafb4a49e09b1b86e76f3f5a2df2f5fb21e6cd2706ae21d28159b209191
|
File details
Details for the file py_mockserver-0.1.6-py3-none-any.whl.
File metadata
- Download URL: py_mockserver-0.1.6-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67a8785e0e4caf9eaa5c6cab2f766357ac39e90aeba6c845cf5759fed2c87299
|
|
| MD5 |
d940526db762ebd2a522c8c3d5f97f90
|
|
| BLAKE2b-256 |
e4655e55712d0ead8f6b08777fc4c5c6057050ed4893f76f276ff25c32f0c709
|