From fd9df3a62901668db1496ade0c0e33ee5c1b47e0 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 11 Sep 2025 19:02:33 -0500 Subject: [PATCH] fixes --- tests/unit_tests/test_main.py | 44 ----------------------------------- 1 file changed, 44 deletions(-) diff --git a/tests/unit_tests/test_main.py b/tests/unit_tests/test_main.py index a00d8ce43a..ce19f18a1f 100644 --- a/tests/unit_tests/test_main.py +++ b/tests/unit_tests/test_main.py @@ -581,47 +581,3 @@ def test_address_cache_get_methods() -> None: assert cache.has_cache() is True empty_cache = AddressCache() assert empty_cache.has_cache() is False - - -def test_address_cache_hostname_normalization() -> None: - """Test that hostnames are normalized for cache lookups.""" - from esphome.address_cache import normalize_hostname - - # Test normalize_hostname function - assert normalize_hostname("test.local") == "test.local" - assert normalize_hostname("test.local.") == "test.local" - assert normalize_hostname("TEST.LOCAL") == "test.local" - assert normalize_hostname("TeSt.LoCaL.") == "test.local" - assert normalize_hostname("example.com.") == "example.com" - - # Test cache with normalized lookups - cache = AddressCache( - mdns_cache={"test.local": ["192.168.1.1"]}, - dns_cache={"example.com": ["10.0.0.1"]}, - ) - - # Should find with different case and trailing dots - assert cache.get_mdns_addresses("test.local") == ["192.168.1.1"] - assert cache.get_mdns_addresses("TEST.LOCAL") == ["192.168.1.1"] - assert cache.get_mdns_addresses("test.local.") == ["192.168.1.1"] - assert cache.get_mdns_addresses("TEST.LOCAL.") == ["192.168.1.1"] - - assert cache.get_dns_addresses("example.com") == ["10.0.0.1"] - assert cache.get_dns_addresses("EXAMPLE.COM") == ["10.0.0.1"] - assert cache.get_dns_addresses("example.com.") == ["10.0.0.1"] - assert cache.get_dns_addresses("EXAMPLE.COM.") == ["10.0.0.1"] - - # Test from_cli_args also normalizes - cache = AddressCache.from_cli_args( - ["TEST.LOCAL.=192.168.1.1"], ["EXAMPLE.COM.=10.0.0.1"] - ) - - # Should store as normalized - assert "test.local" in cache.mdns_cache - assert "example.com" in cache.dns_cache - - # Should find with any variation - assert cache.get_addresses("test.local") == ["192.168.1.1"] - assert cache.get_addresses("TEST.LOCAL.") == ["192.168.1.1"] - assert cache.get_addresses("example.com") == ["10.0.0.1"] - assert cache.get_addresses("EXAMPLE.COM.") == ["10.0.0.1"]