Skip to content
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

Merged
merged 4 commits into from Feb 23, 2024

Conversation

T-256
Copy link
Contributor

@T-256 T-256 commented Jan 16, 2024

Summary

chunk of #2851

)

client = httpx.Client()
headers = client._redirect_headers(request, url, "GET")
Copy link
Member

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?

Copy link
Member

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?)

Copy link
Contributor Author

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:

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

tests/test_utils.py Outdated Show resolved Hide resolved
Copy link
Member

@tomchristie tomchristie left a 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.

@tomchristie tomchristie merged commit e745060 into encode:master Feb 23, 2024
5 checks passed
@tomchristie tomchristie added the refactor Issues and PRs related to code refactoring label Feb 23, 2024
shepilov-vladislav pushed a commit to shepilov-vladislav/httpx that referenced this pull request Mar 28, 2024
* test `is_https_redirect` via public api

* Update tests/test_utils.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Issues and PRs related to code refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants