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'
SERVER.RESPONSE['get'] = token
data = urlopen(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.1.tar.gz
(4.2 kB
view details)
File details
Details for the file test-server-0.0.1.tar.gz
.
File metadata
- Download URL: test-server-0.0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dc80ae39208f9040d802a895104cb5fc4962ba2257d8ebdc2324b03f11c83a7 |
|
MD5 | 18fcf67c7ef6ae94de22c65d8c538448 |
|
BLAKE2b-256 | 79ca84a1c321273bf17f1781422e4667a40e0336ea09d125ba572487e1d394a1 |