test obfuscate_sensitive_headers via public api (#3063)

This commit is contained in:
T-256 2024-01-16 13:23:23 +03:30 committed by GitHub
parent 15f925336c
commit c7cd6aa5bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,6 @@ from httpx._utils import (
get_ca_bundle_from_env,
get_environment_proxies,
is_https_redirect,
obfuscate_sensitive_headers,
parse_header_links,
same_origin,
)
@ -215,10 +214,9 @@ def test_get_environment_proxies(environment, proxies):
],
)
def test_obfuscate_sensitive_headers(headers, output):
bytes_headers = [(k.encode(), v.encode()) for k, v in headers]
bytes_output = [(k.encode(), v.encode()) for k, v in output]
assert list(obfuscate_sensitive_headers(headers)) == output
assert list(obfuscate_sensitive_headers(bytes_headers)) == bytes_output
as_dict = {k: v for k, v in output}
headers_class = httpx.Headers({k: v for k, v in headers})
assert repr(headers_class) == f"Headers({as_dict!r})"
def test_same_origin():