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'
self.server.response['get'] = token
data = urlopen(self.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.6.tar.gz
(5.2 kB
view details)
File details
Details for the file test-server-0.0.6.tar.gz
.
File metadata
- Download URL: test-server-0.0.6.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34f71b5456cd7394155bc1aa0632eada4d6e6d3f4e7e698bfc178e72a294082b |
|
MD5 | b2acbada3f3059f3b43117c0e0c0f8fd |
|
BLAKE2b-256 | efc3532d575c8234c222185d84917bf921bb3558bf3bd0649d1120fec4b21314 |