-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1112 from pypa/bug/1111
Preserve ports when munging repository URLs
- Loading branch information
Showing
4 changed files
with
51 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Fix bug for Repository URLs with auth where the port was lost. When attempting | ||
to prevent printing authentication credentials in URLs provided with username | ||
and password, we did not properly handle the case where the URL also contains | ||
a port (when reconstructing the URL). This is now handled and tested to ensure | ||
no regressions. |
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,15 +150,38 @@ 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( | ||
"repository_url, expected_config", | ||
[ | ||
( | ||
"https://user:[email protected]/pypi", | ||
{ | ||
"repository": "https://notexisting.python.org/pypi", | ||
"username": "user", | ||
"password": "pass", | ||
}, | ||
), | ||
( | ||
"https://auser:[email protected]:8443", | ||
{ | ||
"repository": "https://pypi.proxy.local.repo.net:8443", | ||
"username": "auser", | ||
"password": "pass", | ||
}, | ||
), | ||
], | ||
) | ||
def test_get_repository_config_url_with_auth( | ||
config_file, repository_url, expected_config | ||
): | ||
assert ( | ||
utils.get_repository_from_config(config_file, "foo", repository_url) | ||
== expected_config | ||
) | ||
assert ( | ||
utils.get_repository_from_config(config_file, "pypi", repository_url) | ||
== expected_config | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
|
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