Add a separate testcase for special chars in userinfo and revert changes to other tests
This commit is contained in:
parent
ae5fc8b0f5
commit
c6b149207c
|
@ -56,6 +56,23 @@ class BaseTestParsesURIs:
|
|||
assert uri.path is None
|
||||
assert uri.query is None
|
||||
assert uri.fragment is None
|
||||
assert uri.userinfo == 'user:pass'
|
||||
|
||||
def test_handles_tricky_userinfo(
|
||||
self, uri_with_port_and_tricky_userinfo):
|
||||
"""
|
||||
Test that self.test_class can handle a URI with unusual
|
||||
(non a-z) chars in userinfo.
|
||||
"""
|
||||
uri = self.test_class.from_string(uri_with_port_and_tricky_userinfo)
|
||||
assert uri.scheme == 'ssh'
|
||||
# 6 == len('ftp://')
|
||||
assert uri.authority == uri_with_port_and_tricky_userinfo[6:]
|
||||
assert uri.host != uri.authority
|
||||
assert str(uri.port) == '22'
|
||||
assert uri.path is None
|
||||
assert uri.query is None
|
||||
assert uri.fragment is None
|
||||
assert uri.userinfo == 'user%20!=:pass'
|
||||
|
||||
def test_handles_basic_uri_with_path(self, basic_uri_with_path):
|
||||
|
@ -93,7 +110,7 @@ class BaseTestParsesURIs:
|
|||
assert uri.path == '/path/to/resource'
|
||||
assert uri.query == 'key=value'
|
||||
assert uri.fragment == 'fragment'
|
||||
assert uri.userinfo == 'user%20!=:pass'
|
||||
assert uri.userinfo == 'user:pass'
|
||||
assert str(uri.port) == '443'
|
||||
|
||||
def test_handles_relative_uri(self, relative_uri):
|
||||
|
|
|
@ -77,6 +77,11 @@ def basic_uri_with_port(request):
|
|||
|
||||
@pytest.fixture(params=valid_hosts)
|
||||
def uri_with_port_and_userinfo(request):
|
||||
return 'ssh://user:pass@%s:22' % request.param
|
||||
|
||||
|
||||
@pytest.fixture(params=valid_hosts)
|
||||
def uri_with_port_and_tricky_userinfo(request):
|
||||
return 'ssh://%s@%s:22' % ('user%20!=:pass', request.param)
|
||||
|
||||
|
||||
|
@ -92,8 +97,8 @@ def uri_with_path_and_query(request):
|
|||
|
||||
@pytest.fixture(params=valid_hosts)
|
||||
def uri_with_everything(request):
|
||||
return 'https://%s@%s:443/path/to/resource?key=value#fragment' % (
|
||||
'user%20!=:pass', request.param)
|
||||
return 'https://user:pass@%s:443/path/to/resource?key=value#fragment' % (
|
||||
request.param)
|
||||
|
||||
|
||||
@pytest.fixture(params=valid_hosts)
|
||||
|
|
|
@ -113,7 +113,7 @@ class TestParseResultBytes:
|
|||
assert uri.path == b'/path/to/resource'
|
||||
assert uri.query == b'key=value'
|
||||
assert uri.fragment == b'fragment'
|
||||
assert uri.userinfo == b'user%20!=:pass'
|
||||
assert uri.userinfo == b'user:pass'
|
||||
assert uri.port == 443
|
||||
assert isinstance(uri.authority, bytes) is True
|
||||
|
||||
|
|
Loading…
Reference in New Issue