-
-
Notifications
You must be signed in to change notification settings - Fork 857
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle URL quoting username and password components. (#1159)
* Handle URL quoting username and password components * Tweak userinfo quoting
- Loading branch information
1 parent
557ad70
commit 655773e
Showing
2 changed files
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,6 +187,18 @@ def test_url_copywith_for_authority(): | |
assert str(new) == "https://username:[email protected]:444" | ||
|
||
|
||
def test_url_copywith_for_userinfo(): | ||
copy_with_kwargs = { | ||
"username": "[email protected]", | ||
"password": "abc123@ %", | ||
} | ||
url = URL("https://example.org") | ||
new = url.copy_with(**copy_with_kwargs) | ||
assert str(new) == "https://tom%40example.org:abc123%40%20%[email protected]" | ||
assert new.username == "[email protected]" | ||
assert new.password == "abc123@ %" | ||
|
||
|
||
def test_url_invalid(): | ||
with pytest.raises(InvalidURL): | ||
URL("https://😇/") |