Skip to content

Commit

Permalink
[py] Add test for warning when embedding user:pass in URL
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 committed Nov 6, 2024
1 parent 9ae1d7b commit b40dd0e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ def test_get_remote_connection_headers_defaults():

def test_get_remote_connection_headers_adds_auth_header_if_pass():
url = "http://user:pass@remote"
headers = RemoteConnection.get_remote_connection_headers(parse.urlparse(url))
with pytest.warns(None) as record:
headers = RemoteConnection.get_remote_connection_headers(parse.urlparse(url))
assert headers.get("Authorization") == "Basic dXNlcjpwYXNz"
assert (
record[0].message.args[0]
== "Embedding username and password in URL could be insecure, use ClientConfig instead"
)


def test_get_remote_connection_headers_adds_keep_alive_if_requested():
Expand Down

0 comments on commit b40dd0e

Please sign in to comment.