server: Allow a server address with a subpath.

This commit is contained in:
Damir Jelić 2019-02-03 10:21:59 +01:00
parent 54ad615431
commit 107a7a606e
2 changed files with 44 additions and 1 deletions

19
tests/server_test.py Normal file
View file

@ -0,0 +1,19 @@
from matrix.server import MatrixServer
from matrix._weechat import MockConfig
import matrix.globals as G
G.CONFIG = MockConfig()
class TestClass(object):
def test_address_parsing(self):
host = MatrixServer._parse_url("example.org", "443")
assert host == "example.org:443"
host = MatrixServer._parse_url("example.org/_matrix", "443")
assert host == "example.org:443/_matrix"
host = MatrixServer._parse_url("https://example.org/_matrix", "443")
assert host == "example.org:443/_matrix"
host = MatrixServer._parse_url("https://example.org", "443")
assert host == "example.org:443"