Skip to content

Commit

Permalink
Added test for passing ipv6 loopback host
Browse files Browse the repository at this point in the history
  • Loading branch information
sjsadowski committed Oct 24, 2021
1 parent b764156 commit 60b7086
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_cli.py
Expand Up @@ -78,6 +78,7 @@ def test_host_port(cmd):
assert exitcode != 1
assert firstline == b"Goin' Fast @ http://127.0.0.127:9999"


@pytest.mark.parametrize(
"cmd",
(
Expand All @@ -95,6 +96,23 @@ def test_host_port(cmd):
assert firstline == b"Goin' Fast @ http://[::]:9999"


@pytest.mark.parametrize(
"cmd",
(
("--host=::1", "--port=9999"),
("-H", "::1", "-p", "9999"),
),
)
def test_host_port(cmd):
command = ["sanic", "fake.server.app", *cmd]
out, err, exitcode = capture(command)
lines = out.split(b"\n")
firstline = lines[6]

assert exitcode != 1
assert firstline == b"Goin' Fast @ http://[::1]:9999"


@pytest.mark.parametrize(
"num,cmd",
(
Expand Down

0 comments on commit 60b7086

Please sign in to comment.