Server for testing HTTP clients
Project description
Simple HTTP Server for testing 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.32.tar.gz
(10.1 kB
view details)
File details
Details for the file test-server-0.0.32.tar.gz
.
File metadata
- Download URL: test-server-0.0.32.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.26.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0308a966fa7f19974814b5cfa0c8d3216fdde92f8ff49ce6c56d77b57da9dbc2 |
|
MD5 | 2866e921fc32196ade96a1a47e7b9e7a |
|
BLAKE2b-256 | 948cc977611847a3084ab35391346ac012473220d412a9ffb05775b0e58db509 |