Server to test HTTP clients
Project description
HTTP Server to test HTTP clients.
Installation
pip install test-server
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)
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.28.tar.gz
(12.9 kB
view details)
File details
Details for the file test-server-0.0.28.tar.gz
.
File metadata
- Download URL: test-server-0.0.28.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320357a5fd4eb827c84193a674335b6da3232b9f960f17b78bdad7ff4111d2a2 |
|
MD5 | ec6add48bfeb7908a8b5255436b9cec5 |
|
BLAKE2b-256 | 78a94c2ba37ad71c604922ddb6b26f13dd31630485492cca9e58d5930fcf7209 |