weechat-matrix/tests/server_test.py

22 lines
797 B
Python
Raw Normal View History

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-07-03 21:20:07 +02:00
homeserver = MatrixServer._parse_url("example.org", 8080)
assert homeserver.hostname == "example.org"
assert homeserver.geturl() == "https://example.org:8080"
2019-07-03 21:20:07 +02:00
homeserver = MatrixServer._parse_url("example.org/_matrix", 80)
assert homeserver.hostname == "example.org"
assert homeserver.geturl() == "https://example.org:80/_matrix"
2019-07-03 21:20:07 +02:00
homeserver = MatrixServer._parse_url(
"https://example.org/_matrix", 80
)
2019-07-03 21:20:07 +02:00
assert homeserver.hostname == "example.org"
assert homeserver.geturl() == "https://example.org:80/_matrix"