mirror of
https://github.com/sshuttle/sshuttle.git
synced 2024-11-28 19:03:26 +01:00
9c5f1f5bbf
This fixes #488 and provides an alternative solution for #489.
21 lines
830 B
Python
21 lines
830 B
Python
from sshuttle.ssh import parse_hostport
|
|
|
|
|
|
def test_host_only():
|
|
assert parse_hostport("host") == (None, None, None, "host")
|
|
assert parse_hostport("1.2.3.4") == (None, None, None, "1.2.3.4")
|
|
assert parse_hostport("2001::1") == (None, None, None, "2001::1")
|
|
assert parse_hostport("[2001::1]") == (None, None, None, "2001::1")
|
|
|
|
|
|
def test_host_and_port():
|
|
assert parse_hostport("host:22") == (None, None, 22, "host")
|
|
assert parse_hostport("1.2.3.4:22") == (None, None, 22, "1.2.3.4")
|
|
assert parse_hostport("[2001::1]:22") == (None, None, 22, "2001::1")
|
|
|
|
|
|
def test_username_and_host():
|
|
assert parse_hostport("user@host") == ("user", None, None, "host")
|
|
assert parse_hostport("user:@host") == ("user", None, None, "host")
|
|
assert parse_hostport("user:pass@host") == ("user", "pass", None, "host")
|