Easily test your HTTP library against a local copy of pypi
Project description
httpbin is an amazing web service for testing HTTP libraries. It has several great endpoints that can test pretty much everything you need in a HTTP library. The only problem is: maybe you don’t want to wait for your tests to travel across the Internet and back to make assertions against a remote web service.
Enter pytest-httpbin. Pytest-httpbin creates a pytest “fixture” that is dependency-injected into your tests. It automatically starts up a HTTP server in a separate thread running httpbin and provides your test with the URL in the fixture. Check out this example:
def test_that_my_library_works_kinda_ok(httpbin):
assert requests.get(httpbin.url + '/get/').status_code == 200
This replaces a test that might have looked like this before:
def test_that_my_library_works_kinda_ok():
assert requests.get('http://httpbin.org/get').status_code == 200
pytest-httpbin also supports https and includes its own CA cert you can use. Check out the full documentation on the github page.
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
Built Distribution
File details
Details for the file pytest-pypi-0.1.0.tar.gz
.
File metadata
- Download URL: pytest-pypi-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7a7ca2bc5d2cf4430cee08e5f49d7ec42471fd011d060babefa6ae8fa6a00ff |
|
MD5 | e718ac6ea35318b3269ec1419e8c4920 |
|
BLAKE2b-256 | d78bbc5bc4198eafd7da5570e3961b9ea570d72c406623940076448dfba28639 |
Provenance
File details
Details for the file pytest_pypi-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pytest_pypi-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f02398a030b224a6db8fc988d698dbbb9fb1c1e982050add4d754628e048ab6 |
|
MD5 | bc40554061be69bbcd16a60f6284bfee |
|
BLAKE2b-256 | cadb4bf1730ccd8d44052098016a1e512bd771027ff1ecd1869c198115f8a4b9 |