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.
()
| 254 | |
| 255 | |
| 256 | def 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( |