Here's a test I've tried writing:
import httpretty
import requests
@httpretty.activate
def test():
httpretty.register_uri(
httpretty.GET,
"http://localhost:8000",
body='{"origin": "127.0.0.1"}',
status=200
)
requests.get("http://localhost:8000")
When I run it with pytest
, however, I get
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
Looking at the documentation, I thought I'd followed it ad verbatim - any suggestions?