skip to navigation
skip to content

Not Logged In

pytest-httpbin 0.0.2

Easily test your HTTP library against a local copy of httpbin

Latest Version: 0.0.7

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.

 
File Type Py Version Uploaded on Size
pytest-httpbin-0.0.2.tar.gz (md5) Source 2014-07-06 7KB
pytest_httpbin-0.0.2-py2.py3-none-any.whl (md5) Python Wheel 3.4 2014-07-06 10KB
  • Downloads (All Versions):
  • 87 downloads in the last day
  • 920 downloads in the last week
  • 1803 downloads in the last month