Пример #1
0
    def test_unsecure_listener_no_listeners_open_private_ports_false(self):
        conf = yaml.safe_load(ServerConfig().generate_config_section(
            "che.org",
            "/data_dir_path",
            False,
            None,
            config_dir_path="CONFDIR"))

        expected_listeners = [{
            "port":
            8008,
            "tls":
            False,
            "type":
            "http",
            "x_forwarded":
            True,
            "bind_addresses": ["::1", "127.0.0.1"],
            "resources": [{
                "names": ["client", "federation"],
                "compress": False
            }],
        }]

        self.assertEqual(conf["listeners"], expected_listeners)
Пример #2
0
    def test_listeners_set_correctly_open_private_ports_true(self):
        listeners = [
            {
                "port": 8448,
                "resources": [{"names": ["federation"]}],
                "tls": True,
                "type": "http",
            },
            {
                "port": 443,
                "resources": [{"names": ["client"]}],
                "tls": False,
                "type": "http",
            },
            {
                "port": 1243,
                "resources": [{"names": ["client"]}],
                "tls": False,
                "type": "http",
                "bind_addresses": ["this_one_is_bound"],
            },
        ]

        expected_listeners = listeners.copy()
        expected_listeners[1]["bind_addresses"] = ["::1", "127.0.0.1"]

        conf = yaml.safe_load(
            ServerConfig().generate_config_section(
                "this.one.listens", "/data_dir_path", True, listeners
            )
        )

        self.assertEqual(conf["listeners"], expected_listeners)
Пример #3
0
    def test_listeners_set_correctly_open_private_ports_false(self):
        listeners = [
            {
                "port": 8448,
                "resources": [{"names": ["federation"]}],
                "tls": True,
                "type": "http",
            },
            {
                "port": 443,
                "resources": [{"names": ["client"]}],
                "tls": False,
                "type": "http",
            },
        ]

        conf = yaml.safe_load(
            ServerConfig().generate_config_section(
                "this.one.listens", "/data_dir_path", True, listeners
            )
        )

        self.assertEqual(conf["listeners"], listeners)
Пример #4
0
 def is_threepid_reserved(threepid):
     return ServerConfig.is_threepid_reserved(config, threepid)
Пример #5
0
 def is_threepid_reserved(threepid):
     return ServerConfig.is_threepid_reserved(config, threepid)
Пример #6
0
 def is_threepid_reserved(threepid):
     return ServerConfig.is_threepid_reserved(
         config.mau_limits_reserved_threepids, threepid)