Skip to main content

A simple web server for unit testing purposes. Acts as context manager for teardown.

Project description

Mock Web Server

CircleCI Coverage

A simple web server for unit testing purposes. Acts as context manager for teardown.

How to develop

pip install -r requirements.txt

How to use

from mockwebserver import MockWebServer()
import requests

def test_requests_get():
    with MockWebServer() as server:
        url = server.set('/path/to/page', "page content")
        response = requests.get(url)
        assert response.ok
        assert response.text = "page content"

How to distribute

If you need to publish a new version of this package you can use this command:

$ make build
$ make dist

License

Licensed under MIT license. View license.

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

mockwebserver-0.5.0.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

mockwebserver-0.5.0-py2.py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page