-
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix URL.build not validating that path has a leading slash when passi…
…ng authority The validation only worked when host was passed
- Loading branch information
Showing
2 changed files
with
15 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,12 +140,18 @@ def test_build_with_invalid_host(host: str, is_authority: bool): | |
|
||
|
||
def test_build_with_authority(): | ||
url = URL.build(scheme="http", authority="степан:[email protected]:8000", path="path") | ||
url = URL.build(scheme="http", authority="степан:[email protected]:8000", path="/path") | ||
assert ( | ||
str(url) == "http://%D1%81%D1%82%D0%B5%D0%BF%D0%B0%D0%BD:[email protected]:8000/path" | ||
) | ||
|
||
|
||
def test_build_with_authority_no_leading_flash(): | ||
msg = r"Path in a URL with authority should start with a slash \('/'\) if set" | ||
with pytest.raises(ValueError, match=msg): | ||
URL.build(scheme="http", authority="степан:[email protected]:8000", path="path") | ||
|
||
|
||
def test_build_with_authority_without_encoding(): | ||
url = URL.build( | ||
scheme="http", authority="foo:[email protected]:8000", path="path", encoded=True | ||
|
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