Properly handle the first source having user/pass

This commit is contained in:
Michael Hoang
2018-07-27 12:59:45 +10:00
committed by Dan Ryan
parent 1efae0384f
commit 0969a9ee67
2 changed files with 15 additions and 1 deletions
+1 -1
View File
@@ -200,7 +200,7 @@ def prepare_pip_source_args(sources, pip_args=None):
# Trust the host if it's not verified.
if not sources[0].get("verify_ssl", True):
pip_args.extend(
["--trusted-host", urlparse(sources[0]["url"]).netloc.split(":")[0]]
["--trusted-host", urlparse(sources[0]["url"]).hostname]
)
# Add additional sources as extra indexes.
if len(sources) > 1:
+14
View File
@@ -371,6 +371,20 @@ twine = "*"
"https://user:password@custom.example.com/simple",
],
),
(
[
{
"url": "https://user:password@custom.example.com/simple",
"verify_ssl": False,
},
],
[
"-i",
"https://user:password@custom.example.com/simple",
"--trusted-host",
"custom.example.com",
],
),
],
)
def test_prepare_pip_source_args(self, sources, expected_args):