MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby and a simple REST API (as shown below). MockServer Proxy is a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding). Both MockServer and the MockServer Proxy record all received requests so that it is possible to verify exactly what requests have been sent by the system under test.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 5.3.0
- Package version: 5.3.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python 2.7 and 3.4+
If the python package is hosted on Github, you can install directly from Github
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
)
Then import the package:
import mockserver
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import mockserver
Please follow the installation procedure and then run the following:
from __future__ import print_function
import time
import mockserver
from mockserver.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = mockserver.ControlApi(mockserver.ApiClient(configuration))
ports = mockserver.Ports() # Ports | list of ports to bind to, where 0 indicates dynamically bind to any available port
try:
# bind additional listening ports
api_response = api_instance.bind_put(ports)
pprint(api_response)
except ApiException as e:
print("Exception when calling ControlApi->bind_put: %s\n" % e)
All URIs are relative to http://localhost:1080
Class | Method | HTTP request | Description |
---|---|---|---|
ControlApi | bind_put | PUT /bind | bind additional listening ports |
ControlApi | clear_put | PUT /clear | clears expectations and recorded requests that match the request matcher |
ControlApi | reset_put | PUT /reset | clears all expectations and recorded requests |
ControlApi | retrieve_put | PUT /retrieve | retrieve recorded requests, active expectations, recorded expectations or log messages |
ControlApi | status_put | PUT /status | return listening ports |
ControlApi | stop_put | PUT /stop | stop running process |
ExpectationApi | expectation_put | PUT /expectation | create expectation |
VerifyApi | verify_put | PUT /verify | verify a request has been received a specific number of times |
VerifyApi | verify_sequence_put | PUT /verifySequence | verify a sequence of request has been received in the specific order |
- Body
- BodyWithContentType
- ConnectionOptions
- Delay
- Expectation
- Expectations
- HttpClassCallback
- HttpError
- HttpForward
- HttpObjectCallback
- HttpOverrideForwardedRequest
- HttpRequest
- HttpResponse
- HttpTemplate
- KeyToMultiValue
- KeyToValue
- Ports
- TimeToLive
- Times
- Verification
- VerificationSequence
- VerificationTimes
All endpoints do not require authorization.