-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly handle repository URLs with auth in them
- Loading branch information
1 parent
8b85f4d
commit 572aebb
Showing
3 changed files
with
56 additions
and
29 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 |
---|---|---|
|
@@ -150,6 +150,28 @@ def test_get_repository_config_missing(config_file): | |
assert utils.get_repository_from_config(config_file, "pypi") == exp | ||
|
||
|
||
def test_get_repository_config_url_with_auth(config_file): | ||
repository_url = "https://user:[email protected]/pypi" | ||
exp = { | ||
"repository": "https://notexisting.python.org/pypi", | ||
"username": "user", | ||
"password": "pass", | ||
} | ||
assert utils.get_repository_from_config(config_file, "foo", repository_url) == exp | ||
assert utils.get_repository_from_config(config_file, "pypi", repository_url) == exp | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_url, expected_url", | ||
[ | ||
("https://upload.pypi.org/legacy/", "https://upload.pypi.org/legacy/"), | ||
("https://user:[email protected]/legacy/", "https://********@upload.pypi.org/legacy/"), | ||
], | ||
) | ||
def test_sanitize_url(input_url: str, expected_url: str) -> None: | ||
assert utils.sanitize_url(input_url) == expected_url | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"repo_url, message", | ||
[ | ||
|
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