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.

Files for mockwebserver, version 0.5.0
Filename, size File type Python version Upload date Hashes
Filename, size mockwebserver-0.5.0-py2.py3-none-any.whl (4.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size mockwebserver-0.5.0.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page