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.26.tar.gz
(9.7 kB
view details)
File details
Details for the file test-server-0.0.26.tar.gz
.
File metadata
- Download URL: test-server-0.0.26.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2b01488fb05be265cb2b547b3dd50f3f55707e642f6aab2b3f3934fbfd3d247 |
|
MD5 | 809470a76f7fe6071495f1b839465a81 |
|
BLAKE2b-256 | 7d60a19854b47a92a09ff88df3ae13b4e4cbfdb0c49dc2c921c6c320a01ec2df |