示例#1
0
def test_parse_address(source, result):
    if result is None:
        with pytest.raises(ConfigurationError) as exc:
            parse_address(source)
        assert 'Misconfigured bind address' in str(exc)
        assert '`foo`' in str(exc)

    else:
        assert parse_address(source) == result
示例#2
0
def test_parse_address(source, result):
    if result is None:
        with pytest.raises(ConfigurationError) as exc:
            parse_address(source)
        assert 'Misconfigured bind address' in str(exc)
        assert '`foo`' in str(exc)

    else:
        assert parse_address(source) == result
示例#3
0
 def bind_addr(self):
     _default = '0.0.0.0:8000'
     address_str = self.container.config.get(WEB_SERVER_CONFIG_KEY,
                                             _default)
     if address_str.startswith('fd://'):
         address_str = _default
     return parse_address(address_str)
示例#4
0
def web_config_port(web_config):
    from nameko.constants import WEB_SERVER_CONFIG_KEY
    from nameko.web.server import parse_address
    return parse_address(web_config[WEB_SERVER_CONFIG_KEY]).port
示例#5
0
def web_config_port(web_config):
    from nameko.constants import WEB_SERVER_CONFIG_KEY
    from nameko.web.server import parse_address
    return parse_address(web_config[WEB_SERVER_CONFIG_KEY]).port
示例#6
0
def test_web_config(web_config):
    assert WEB_SERVER_CONFIG_KEY in web_config

    bind_address = parse_address(web_config[WEB_SERVER_CONFIG_KEY])
    sock = socket.socket()
    sock.bind(bind_address)
示例#7
0
def web_config_port(web_config):
    return parse_address(web_config['WEB_SERVER_ADDRESS']).port
示例#8
0
def test_web_config(web_config):
    assert WEB_SERVER_CONFIG_KEY in web_config

    bind_address = parse_address(web_config[WEB_SERVER_CONFIG_KEY])
    sock = socket.socket()
    sock.bind(bind_address)
示例#9
0
def web_config_port(web_config):
    return parse_address(web_config['WEB_SERVER_ADDRESS']).port
示例#10
0
 def bind_addr(self):
     address_str = self.container.config.get(
         "MANAGEMENT_WEB_SERVER_CONFIG", '0.0.0.0:8980')
     return parse_address(address_str)