From 0ecc9f0acae56d5f23863f83638f0b9069500ad2 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Mon, 29 Oct 2018 09:58:30 -0700 Subject: [PATCH] Add failing tests for redact_netloc(). --- tests/unit/test_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 4c1c817094d..89af7f4e589 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -687,6 +687,8 @@ def test_split_auth_from_netloc(netloc, expected): ('user:pass@word@example.com', 'user:****@example.com'), # Test the password containing a : symbol. ('user:pass:word@example.com', 'user:****@example.com'), + # Test URL-encoded reserved characters. + ('user%3Aname:%23%40%5E@example.com', 'user%3Aname:****@example.com'), ]) def test_redact_netloc(netloc, expected): actual = redact_netloc(netloc) @@ -718,7 +720,10 @@ def test_remove_auth_from_url(auth_url, expected_url): ('https://user@example.com/abc', 'https://user@example.com/abc'), ('https://user:password@example.com', 'https://user:****@example.com'), ('https://user:@example.com', 'https://user:****@example.com'), - ('https://example.com', 'https://example.com') + ('https://example.com', 'https://example.com'), + # Test URL-encoded reserved characters. + ('https://user%3Aname:%23%40%5E@example.com', + 'https://user%3Aname:****@example.com'), ]) def test_redact_password_from_url(auth_url, expected_url): url = redact_password_from_url(auth_url)