diff options
| author | Dennis Fink | 2026-11-13 17:00:10 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-13 17:00:10 +0100 |
| commit | 6d9cfbabafd373aaca7b9f9ed607f9aa4b39f3b9 (patch) | |
| tree | c057f5cfa5f066a85537efa2da56afd49b8ae7d7 /tests | |
| parent | 3496b3882ca08e74c108d5abe417eccec5ed4f48 (diff) | |
| download | webmentions-ssg-6d9cfbabafd373aaca7b9f9ed607f9aa4b39f3b9.tar.gz webmentions-ssg-6d9cfbabafd373aaca7b9f9ed607f9aa4b39f3b9.zip | |
refactor(core): extract hostname resolution helper
Move DNS resolution and address parsing into a dedicated helper so
public address validation resolves hostnames through a single, testable
path.
Diffstat (limited to '')
| -rw-r--r-- | tests/test_net.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_net.py b/tests/test_net.py index 928a0d5..05ae5a4 100644 --- a/tests/test_net.py +++ b/tests/test_net.py @@ -191,6 +191,16 @@ def test_ip_literal_does_not_use_dns() -> None: dns_resolve.assert_not_called() +def test_public_addresses_resolves_hostname_once() -> None: + with patch("webmentions_ssg.net.dns.resolver.resolve_name") as resolve: + resolve.return_value.addresses.return_value = ["93.184.216.34", "8.8.8.8"] + assert public_addresses("example.com", lifetime=1.5) == ( + "93.184.216.34", + "8.8.8.8", + ) + resolve.assert_called_once_with("example.com", lifetime=1.5) + + @pytest.mark.parametrize( "address", [ |
