diff options
| author | Gabriel Falcão <gabriel@nacaolivre.org> | 2021-05-14 01:11:43 +0200 |
|---|---|---|
| committer | Gabriel Falcão <gabriel@nacaolivre.org> | 2021-05-14 01:13:21 +0200 |
| commit | 2f9a12b6bf305fb7704d2664d606fc45b6754d79 (patch) | |
| tree | 474a2f859374f9427f39b834ae18ac201c22c10c /tests | |
| parent | 519e6d332448c8f97f341944956fe50d5630c2a1 (diff) | |
| download | httpretty-fix/414/httpx.tar.gz | |
implement support to httpx libraryfix/414/httpx
closes #414
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/functional/bugfixes/test_414_httpx.py | 12 | ||||
| -rw-r--r-- | tests/functional/test_debug.py | 10 | ||||
| -rw-r--r-- | tests/functional/test_httpx.py | 15 |
3 files changed, 12 insertions, 25 deletions
diff --git a/tests/functional/bugfixes/test_414_httpx.py b/tests/functional/bugfixes/test_414_httpx.py new file mode 100644 index 0000000..6360ddc --- /dev/null +++ b/tests/functional/bugfixes/test_414_httpx.py @@ -0,0 +1,12 @@ +import httpretty +import httpx +from sure import expect + +@httpretty.activate(verbose=True, allow_net_connect=False) +def test_httpx(): + httpretty.register_uri(httpretty.GET, "https://blog.falcao.it/", + body="Posts") + + response = httpx.get('https://blog.falcao.it') + + expect(response.text).to.equal("Posts") diff --git a/tests/functional/test_debug.py b/tests/functional/test_debug.py index 86de965..ff00840 100644 --- a/tests/functional/test_debug.py +++ b/tests/functional/test_debug.py @@ -58,16 +58,6 @@ def test_httpretty_debugs_socket_sendto(context): ) -@httprettified -@scenario(create_socket) -def test_httpretty_debugs_socket_recv(context): - "HTTPretty should forward_and_trace socket.recv" - - expect(context.sock.recv).when.called.to.throw( - "not connected" - ) - - @skip('not currently supported') @httprettified @scenario(create_socket) diff --git a/tests/functional/test_httpx.py b/tests/functional/test_httpx.py deleted file mode 100644 index 4cb51c4..0000000 --- a/tests/functional/test_httpx.py +++ /dev/null @@ -1,15 +0,0 @@ -import httpretty -import httpx - - -def test_one(): - httpretty.enable() # enable HTTPretty so that it will monkey patch the socket module - httpretty.register_uri(httpretty.GET, "http://yipit.com/", - body="Find the best daily deals") - - response = httpx.get('http://yipit.com') - - assert response.text == "Find the best daily deals" - - httpretty.disable() # disable afterwards, so that you will have no problems in code that uses that socket module - httpretty.reset() # reset HTTPretty state (clean up registered urls and request history) |
