Exemplo n.º 1
0
def test_api_base_url_with_ssl_enable_and_port(mock_stack):
    """Test setting API URL with use_ssl enabled and port."""
    api_config = http.ApiConfig("127.0.0.1",
                                "1.1.1.1",
                                use_ssl=True,
                                port=8888)
    assert api_config.base_url == "https://1.1.1.1:8888"
Exemplo n.º 2
0
 def test_api_base_url_with_ssl_enable(hass):
     """Test setting API URL with use_ssl enabled."""
     api_config = http.ApiConfig('example.com', use_ssl=True)
     assert api_config.base_url == 'https://example.com:8123'
Exemplo n.º 3
0
 def test_api_base_url_with_protocol_and_port(hass):
     """Test setting API URL with protocol and port."""
     api_config = http.ApiConfig('https://example.com', 433)
     assert api_config.base_url == 'https://example.com:433'
Exemplo n.º 4
0
 def test_api_base_url_with_protocol(hass):
     """Test setting API URL with protocol."""
     api_config = http.ApiConfig('https://example.com')
     assert api_config.base_url == 'https://example.com:8123'
Exemplo n.º 5
0
 def test_api_base_url_with_ip_and_port(hass):
     """Test setting API URL with IP and port."""
     api_config = http.ApiConfig('1.1.1.1', 8124)
     assert api_config.base_url == 'http://1.1.1.1:8124'
Exemplo n.º 6
0
 def test_api_base_url_with_ip(hass):
     """Test setting API URL with IP."""
     api_config = http.ApiConfig('1.1.1.1')
     assert api_config.base_url == 'http://1.1.1.1:8123'
Exemplo n.º 7
0
 def test_api_base_url_with_domain(hass):
     """Test setting API URL with domain."""
     api_config = http.ApiConfig('example.com')
     assert api_config.base_url == 'http://example.com:8123'
Exemplo n.º 8
0
def test_api_base_url_with_protocol_and_ssl_enable(mock_stack):
    """Test setting API URL with specific protocol and use_ssl enabled."""
    api_config = http.ApiConfig("127.0.0.1",
                                "http://example.com",
                                use_ssl=True)
    assert api_config.base_url == "http://example.com:8123"
Exemplo n.º 9
0
def test_api_base_url_with_ssl_enable(mock_stack):
    """Test setting API URL with use_ssl enabled."""
    api_config = http.ApiConfig("127.0.0.1", "example.com", use_ssl=True)
    assert api_config.base_url == "https://example.com:8123"
Exemplo n.º 10
0
def test_api_base_url_with_protocol_and_port(mock_stack):
    """Test setting API URL with protocol and port."""
    api_config = http.ApiConfig("127.0.0.1", "https://example.com", 433)
    assert api_config.base_url == "https://example.com:433"
Exemplo n.º 11
0
def test_api_base_url_with_protocol(mock_stack):
    """Test setting API URL with protocol."""
    api_config = http.ApiConfig("127.0.0.1", "https://example.com")
    assert api_config.base_url == "https://example.com:8123"
Exemplo n.º 12
0
def test_api_base_url_with_ip_and_port(mock_stack):
    """Test setting API URL with IP and port."""
    api_config = http.ApiConfig("127.0.0.1", "1.1.1.1", 8124)
    assert api_config.base_url == "http://1.1.1.1:8124"
Exemplo n.º 13
0
def test_api_base_url_with_ip(mock_stack):
    """Test setting API URL with IP."""
    api_config = http.ApiConfig("127.0.0.1", "1.1.1.1")
    assert api_config.base_url == "http://1.1.1.1:8123"
Exemplo n.º 14
0
def test_api_base_url_with_domain(mock_stack):
    """Test setting API URL with domain."""
    api_config = http.ApiConfig("127.0.0.1", "example.com")
    assert api_config.base_url == "http://example.com:8123"
Exemplo n.º 15
0
def test_api_local_ip(mock_stack):
    """Test a trialing slash is removed when setting the API URL."""
    api_config = http.ApiConfig("127.0.0.1", "http://example.com/")
    assert api_config.local_ip == "127.0.0.1"
Exemplo n.º 16
0
 def test_api_base_url_with_ssl_enable_and_port(hass):
     """Test setting API URL with use_ssl enabled and port."""
     api_config = http.ApiConfig('1.1.1.1', use_ssl=True, port=8888)
     assert api_config.base_url == 'https://1.1.1.1:8888'
Exemplo n.º 17
0
 def test_api_base_url_with_protocol_and_ssl_enable(hass):
     """Test setting API URL with specific protocol and use_ssl enabled."""
     api_config = http.ApiConfig('http://example.com', use_ssl=True)
     assert api_config.base_url == 'http://example.com:8123'
Exemplo n.º 18
0
 def test_api_base_url_removes_trailing_slash(hass):
     """Test a trialing slash is removed when setting the API URL."""
     api_config = http.ApiConfig("http://example.com/")
     assert api_config.base_url == "http://example.com:8123"