server: Use the extra_path functionality from nio.

This commit is contained in:
Damir Jelić 2019-02-04 10:42:03 +01:00
parent b884536e7e
commit c680939005
2 changed files with 19 additions and 26 deletions

View file

@ -6,21 +6,20 @@ G.CONFIG = MockConfig()
class TestClass(object):
def test_address_parsing(self):
netloc, host = MatrixServer._parse_url("example.org", "443")
assert host == "example.org:443"
assert netloc == "example.org"
host, extra_path = MatrixServer._parse_url("example.org")
assert host == "example.org"
assert extra_path == ""
netloc, host = MatrixServer._parse_url("example.org/_matrix", "443")
assert host == "example.org:443/_matrix"
assert netloc == "example.org"
host, extra_path = MatrixServer._parse_url("example.org/_matrix")
assert host == "example.org"
assert extra_path == "_matrix"
netloc, host = MatrixServer._parse_url(
"https://example.org/_matrix",
"443"
host, extra_path = MatrixServer._parse_url(
"https://example.org/_matrix"
)
assert host == "example.org:443/_matrix"
assert netloc == "example.org"
assert host == "example.org"
assert extra_path == "_matrix"
netloc, host = MatrixServer._parse_url("https://example.org", "443")
assert host == "example.org:443"
assert netloc == "example.org"
host, extra_path = MatrixServer._parse_url("https://example.org")
assert host == "example.org"
assert extra_path == ""