-
-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test is_https_redirect
via public api
#3064
Conversation
) | ||
|
||
client = httpx.Client() | ||
headers = client._redirect_headers(request, url, "GET") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm. Is there a way around that allows us to test this against public API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be that we're okay with leaning on implementation details a little bit, certainly not a terrible trade-off to make. (I think we already have some instances of this in our test cases right?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we already use private-accessors in another test:
httpx/tests/client/test_proxies.py
Lines 333 to 338 in 4f6edf3
def test_proxy_with_mounts(): | |
proxy_transport = httpx.HTTPTransport(proxy="http://127.0.0.1") | |
client = httpx.Client(mounts={"http://": proxy_transport}) | |
transport = client._transport_for_url(httpx.URL("http://example.com")) | |
assert transport == proxy_transport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay thanks. We're still using private API here, but I do think it's a little neater anyways since it nearly gets us to consistent imports all the way through the tests.
* test `is_https_redirect` via public api * Update tests/test_utils.py
Summary
chunk of #2851