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.15.tar.gz
(6.3 kB
view details)
File details
Details for the file test-server-0.0.15.tar.gz
.
File metadata
- Download URL: test-server-0.0.15.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 350f14786a8d02b127db8f250e3f1d25ed97f45af2ac277b4cd35daf59e9db07 |
|
MD5 | 4e98e4e97defdc81d5cadb3d495d433a |
|
BLAKE2b-256 | 07a53fe19ad9d33ec234a6cf5200bc6d28802976e0492b1b200d966601c18f70 |