Skip to main content

client for http mock server https://github.com/vilus/mocker

Project description

https://badge.fury.io/py/mocker-client.svg https://codecov.io/gh/vilus/mocker_client/branch/master/graph/badge.svg https://travis-ci.org/vilus/mocker_client.svg?branch=master

python client for create/delete mocks on mock server

Example

pip install mocker-client
from mocker_client import MockServer, Mock


mock = MockServer(url='http://127.0.0.1:8080/mocker_api/mocks/').create_mock(
    {'name': 'hi', 'route': '/q', 'method': 'get', 'responses': 'Hi_1'}
)
# actions
mock.delete()
#
help(MockServer.create_mock)
create_mock(self, data)
    :param data: dict with keys:
      'name' - optional, '' by default
      'route' - for example '/some_path'
      'method' - a http method like GET, POST, PUT, etc
      'response_type' - optional, choice from ['single', 'sequence', 'cycle'], 'single' by default
      'responses' - list of dicts with keys (or just dict if response_type is single):
        'body' - response body
        'return_code' - http status code, like 200
        'headers' - dict with http headers
    :returns Mock object
#
help(MockServer.create_mocks)
create_mocks(self, list_data)
    :param list_data: list of dicts with keys:
      'name' - optional, '' by default
      'route' - for example '/some_path'
      'method' - a http method like GET, POST, PUT, etc
      'response_type' - optional, choice from ['single', 'sequence', 'cycle'], 'single' by default
      'responses' - list of dicts with keys (or just dict if response_type is single):
        'body' - response body
        'return_code' - http status code, like 200
        'headers' - dict with http headers
    :returns list of Mock objects
#
help(Mock.delete)
delete(self)
    delete mock on server and return its info - {is_expired: bool}

Project details


Download files

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

Files for mocker-client, version 0.0.5dev1
Filename, size File type Python version Upload date Hashes
Filename, size mocker_client-0.0.5dev1.tar.gz (1.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page