File: server_test.py

package info (click to toggle)
weechat-matrix 0.3.0-3.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 808 kB
  • sloc: python: 7,992; makefile: 27
file content (21 lines) | stat: -rw-r--r-- 797 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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):
        homeserver = MatrixServer._parse_url("example.org", 8080)
        assert homeserver.hostname == "example.org"
        assert homeserver.geturl() == "https://example.org:8080"

        homeserver = MatrixServer._parse_url("example.org/_matrix", 80)
        assert homeserver.hostname == "example.org"
        assert homeserver.geturl() == "https://example.org:80/_matrix"

        homeserver = MatrixServer._parse_url(
            "https://example.org/_matrix", 80
        )
        assert homeserver.hostname == "example.org"
        assert homeserver.geturl() == "https://example.org:80/_matrix"