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.22.tar.gz
(6.0 kB
view details)
File details
Details for the file test-server-0.0.22.tar.gz
.
File metadata
- Download URL: test-server-0.0.22.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7e1f89ed8c72227aecb59fd216cb093e4a4352511c9ef463cf73c6a17025d1d |
|
MD5 | fae766b91410d18594614a00edf6534e |
|
BLAKE2b-256 | 9b167280855131463e6c34782be0603a95769d1b4bfa8f8aa50a186527ae9900 |