2019-02-03 10:21:59 +01:00
|
|
|
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):
|
2019-02-04 10:42:03 +01:00
|
|
|
host, extra_path = MatrixServer._parse_url("example.org")
|
|
|
|
assert host == "example.org"
|
|
|
|
assert extra_path == ""
|
2019-02-03 10:21:59 +01:00
|
|
|
|
2019-02-04 10:42:03 +01:00
|
|
|
host, extra_path = MatrixServer._parse_url("example.org/_matrix")
|
|
|
|
assert host == "example.org"
|
|
|
|
assert extra_path == "_matrix"
|
2019-02-03 10:21:59 +01:00
|
|
|
|
2019-02-04 10:42:03 +01:00
|
|
|
host, extra_path = MatrixServer._parse_url(
|
|
|
|
"https://example.org/_matrix"
|
2019-02-03 22:56:10 +01:00
|
|
|
)
|
2019-02-04 10:42:03 +01:00
|
|
|
assert host == "example.org"
|
|
|
|
assert extra_path == "_matrix"
|
2019-02-03 10:21:59 +01:00
|
|
|
|
2019-02-04 10:42:03 +01:00
|
|
|
host, extra_path = MatrixServer._parse_url("https://example.org")
|
|
|
|
assert host == "example.org"
|
|
|
|
assert extra_path == ""
|