Skip to main content

Server to test HTTP clients

Project description

https://travis-ci.org/lorien/test_server.png?branch=master https://coveralls.io/repos/lorien/test_server/badge.svg?branch=master https://pypip.in/download/test-server/badge.svg?period=month https://pypip.in/version/test-server/badge.svg https://landscape.io/github/lorien/test_server/master/landscape.png

HTTP Server to test HTTP clients.

Usage Example

Example:

from unittest import TestCase
try:
    from urllib import urlopen
except ImportError:
    from urllib.request import urlopen
from test_server import TestServer

class UrllibTestCase(TestCase):
    @classmethod
    def setUpClass(cls):
        cls.server = TestServer()
        cls.server.start()

    @classmethod
    def tearDownClass(cls):
        cls.server.stop()

    def setUp(self):
        self.server.reset()

    def test_get(self):
        token = b'zorro'
        self.server.response['get'] = token
        data = urlopen(self.server.base_url).read()
        self.assertEqual(data, token)

Installation

Run:

pip install test-server

Dependencies

  • tornado

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

test-server-0.0.7.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file test-server-0.0.7.tar.gz.

File metadata

  • Download URL: test-server-0.0.7.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for test-server-0.0.7.tar.gz
Algorithm Hash digest
SHA256 4144bfc807ef06e10d327b643099851445fd3111dfb75d17c2803826a12d2f7d
MD5 b281fc4ddf5a4f87373142ed22935157
BLAKE2b-256 c35a8fba47bc5bec0e6eabcac1ba42736a7ef4376ab3f27177e4ebcc9a2cd65a

See more details on using hashes here.

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