Skip to content

Commit

Permalink
test: add test_use_UnixAdapter_directly
Browse files Browse the repository at this point in the history
This new test tests using the `UnixAdapter` directly, like
[httpie-unixsocket](https://github.com/httpie/httpie-unixsocket) does.

I wrote this test because I found a case, on the `pluggable-urlparse`
branch, where tests were passing, but executing:

```
http http+unix://%2Fvar%2Frun%2Fdocker.sock/info
```

was failing.
  • Loading branch information
msabramo committed Jan 3, 2022
1 parent f5965d8 commit 305215d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions requests_unixsocket/tests/test_requests_unixsocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ def get_sock_prefix(path):
)


def test_use_UnixAdapter_directly():
"""Test using UnixAdapter directly, because
https://github.com/httpie/httpie-unixsocket does this
"""
with UnixSocketServerThread() as usock_thread:
adapter = UnixAdapter()
request = requests.Request(
method='GET',
url='http+unix://%2Fvar%2Frun%2Fdocker.sock/info',
)
url = adapter.request_url(request=request, proxies=None)
assert url == '/info'


def test_unix_domain_adapter_ok():
with UnixSocketServerThread() as usock_thread:
session = Session('http+unix://')
Expand Down

0 comments on commit 305215d

Please sign in to comment.