提交 96dd6de8 编写于 作者: J Jeremy Zafran

made test_remove_auth_from_url a parameterized test

上级 d2853be9
......@@ -627,27 +627,22 @@ def test_call_subprocess_closes_stdin():
call_subprocess([sys.executable, '-c', 'input()'])
def test_remove_auth_from_url():
# Check that the url is doctored appropriately to remove auth elements
# from the url
svn_auth_url = 'https://user:pass@svnrepo.org/svn/project/tags/v0.2'
expected_url = 'https://svnrepo.org/svn/project/tags/v0.2'
url = remove_auth_from_url(svn_auth_url)
assert url == expected_url
# Check that this doesn't impact urls without authentication'
svn_noauth_url = 'https://svnrepo.org/svn/project/tags/v0.2'
expected_url = svn_noauth_url
url = remove_auth_from_url(svn_noauth_url)
assert url == expected_url
# Check that links to specific revisions are handled properly
svn_rev_url = 'https://user:pass@svnrepo.org/svn/project/trunk@8181'
expected_url = 'https://svnrepo.org/svn/project/trunk@8181'
url = remove_auth_from_url(svn_rev_url)
assert url == expected_url
svn_rev_url = 'https://svnrepo.org/svn/project/trunk@8181'
expected_url = 'https://svnrepo.org/svn/project/trunk@8181'
url = remove_auth_from_url(svn_rev_url)
@pytest.mark.parametrize('auth_url, expected_url', [
('https://user:pass@domain.tld/project/tags/v0.2',
'https://domain.tld/project/tags/v0.2'),
('https://domain.tld/project/tags/v0.2',
'https://domain.tld/project/tags/v0.2',),
('https://user:pass@domain.tld/svn/project/trunk@8181',
'https://domain.tld/svn/project/trunk@8181'),
('https://domain.tld/project/trunk@8181',
'https://domain.tld/project/trunk@8181',),
('git+https://pypi.org/something',
'git+https://pypi.org/something'),
('git+https://user:pass@pypi.org/something',
'git+https://pypi.org/something'),
('git+ssh://git@pypi.org/something',
'git+ssh://pypi.org/something'),
])
def test_remove_auth_from_url(auth_url, expected_url):
url = remove_auth_from_url(auth_url)
assert url == expected_url
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册