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.27b1.tar.gz
(12.4 kB
view details)
File details
Details for the file test-server-0.0.27b1.tar.gz
.
File metadata
- Download URL: test-server-0.0.27b1.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1574099ffc61794b1e825a53d73b41b840345d7b775f81ee59c0f78d1411a976 |
|
MD5 | afc8e25d07da26fa016408a0f94231a6 |
|
BLAKE2b-256 | 2f56d12e5b662ebbc6989b5235ec0c3616c86878e10942f5bb9c704386ff2ca8 |