MCPcopy Create free account
hub / github.com/aio-libs/aiohttp / test_proxy_http_auth

Function test_proxy_http_auth

tests/test_proxy_functional.py:380–403  ·  view source on GitHub ↗
(proxy_test_server, get_request)

Source from the content-addressed store, hash-verified

378
379
380async def test_proxy_http_auth(proxy_test_server, get_request) -> None:
381 url = "http://aiohttp.io/path"
382 proxy = await proxy_test_server()
383
384 await get_request(url=url, proxy=proxy.url)
385
386 assert "Authorization" not in proxy.request.headers
387 assert "Proxy-Authorization" not in proxy.request.headers
388
389 auth = aiohttp.BasicAuth("user", "pass")
390 await get_request(url=url, auth=auth, proxy=proxy.url)
391
392 assert "Authorization" in proxy.request.headers
393 assert "Proxy-Authorization" not in proxy.request.headers
394
395 await get_request(url=url, proxy_auth=auth, proxy=proxy.url)
396
397 assert "Authorization" not in proxy.request.headers
398 assert "Proxy-Authorization" in proxy.request.headers
399
400 await get_request(url=url, auth=auth, proxy_auth=auth, proxy=proxy.url)
401
402 assert "Authorization" in proxy.request.headers
403 assert "Proxy-Authorization" in proxy.request.headers
404
405
406async def test_proxy_http_auth_utf8(proxy_test_server, get_request) -> None:

Callers

nothing calls this directly

Calls 2

proxy_test_serverFunction · 0.85
get_requestFunction · 0.85

Tested by

no test coverage detected