mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge pull request #1774 from asherf/jerry
fix prepare_pip_source_args not properly handle user & pw in repo URLs
This commit is contained in:
+1
-1
@@ -260,7 +260,7 @@ def prepare_pip_source_args(sources, pip_args=None):
|
||||
pip_args.extend(
|
||||
[
|
||||
'--trusted-host',
|
||||
urlparse(source['url']).netloc.split(':')[0],
|
||||
urlparse(source['url']).hostname,
|
||||
]
|
||||
)
|
||||
return pip_args
|
||||
|
||||
@@ -358,3 +358,38 @@ twine = "*"
|
||||
assert not git_reformat.local_file
|
||||
# Test regression where VCS uris were being handled as paths rather than VCS entries
|
||||
assert git_reformat.vcs == 'git'
|
||||
|
||||
@pytest.mark.utils
|
||||
@pytest.mark.parametrize(
|
||||
'sources, expected_args',
|
||||
[
|
||||
([{'url': 'https://test.example.com/simple', 'verify_ssl': True}],
|
||||
['-i', 'https://test.example.com/simple']),
|
||||
([{'url': 'https://test.example.com/simple', 'verify_ssl': False}],
|
||||
['-i', 'https://test.example.com/simple', '--trusted-host', 'test.example.com']),
|
||||
|
||||
([{'url': "https://pypi.python.org/simple"},
|
||||
{'url': "https://custom.example.com/simple"}],
|
||||
['-i', 'https://pypi.python.org/simple',
|
||||
'--extra-index-url', 'https://custom.example.com/simple']),
|
||||
|
||||
([{'url': "https://pypi.python.org/simple"},
|
||||
{'url': "https://custom.example.com/simple", 'verify_ssl': False}],
|
||||
['-i', 'https://pypi.python.org/simple',
|
||||
'--extra-index-url', 'https://custom.example.com/simple',
|
||||
'--trusted-host', 'custom.example.com']),
|
||||
|
||||
([{'url': "https://pypi.python.org/simple"},
|
||||
{'url': "https://user:password@custom.example.com/simple", 'verify_ssl': False}],
|
||||
['-i', 'https://pypi.python.org/simple',
|
||||
'--extra-index-url', 'https://user:password@custom.example.com/simple',
|
||||
'--trusted-host', 'custom.example.com']),
|
||||
|
||||
([{'url': "https://pypi.python.org/simple"},
|
||||
{'url': "https://user:password@custom.example.com/simple",}],
|
||||
['-i', 'https://pypi.python.org/simple',
|
||||
'--extra-index-url', 'https://user:password@custom.example.com/simple',]),
|
||||
],
|
||||
)
|
||||
def test_prepare_pip_source_args(self, sources, expected_args):
|
||||
assert pipenv.utils.prepare_pip_source_args(sources, pip_args=None) == expected_args
|
||||
|
||||
Reference in New Issue
Block a user