MCPcopy Index your code
hub / github.com/encode/httpx / test_netrc_auth_credentials_do_not_exist

Function test_netrc_auth_credentials_do_not_exist

tests/client/test_auth.py:256–270  ·  view source on GitHub ↗

When netrc auth is being used and a request is made to a host that is not in the netrc file, then no credentials should be applied.

()

Source from the content-addressed store, hash-verified

254
255
256def test_netrc_auth_credentials_do_not_exist() -> None:
257 """
258 When netrc auth is being used and a request is made to a host that is
259 not in the netrc file, then no credentials should be applied.
260 """
261 netrc_file = str(FIXTURES_DIR / ".netrc")
262 url = "http://example.org"
263 app = App()
264 auth = httpx.NetRCAuth(netrc_file)
265
266 with httpx.Client(transport=httpx.MockTransport(app), auth=auth) as client:
267 response = client.get(url)
268
269 assert response.status_code == 200
270 assert response.json() == {"auth": None}
271
272
273@pytest.mark.skipif(

Callers

nothing calls this directly

Calls 3

AppClass · 0.85
jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected