Server to test HTTP clients
Project description
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['data'] = token
data = urlopen(self.server.base_url).read()
self.assertEqual(data, token)
Installation
Run:
pip install test-server
Dependencies
tornado
Project details
Release history Release notifications | RSS feed
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.12.tar.gz
(5.7 kB
view details)
File details
Details for the file test-server-0.0.12.tar.gz
.
File metadata
- Download URL: test-server-0.0.12.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77338f13de35d49f962f3aebaa5a9768091b728208a003cb02a932977f3d536a |
|
MD5 | eb72353afc859cb52f132c239ceabe1c |
|
BLAKE2b-256 | 71f3e00cdbed09b2cad187704ce8ee7b2d13a4fe1a0372ca8d134510d7ea1cbb |