Avoid fake IPv6 examples

This commit is contained in:
StasonJatham committed 2026-05-21 18:57:45 +02:00
1 parent 03ef2d9af6
commit 9ec3d5c0fb
3 files changed
+41 -12

No files matched your search

+19 -1
View File
@@ -36,7 +36,7 @@ def test_self_service_managed_hostname_generates_random_account(tmp_path: Path)
assert "Manual updates" in response.text
assert "curl -sS" in response.text
assert "203.0.113.10" in response.text
assert "2001:db8::10" in response.text
assert "2001:db8::10" not in response.text
assert "Public:" in response.text
assert "Secret:" in response.text
assert ".ddns.example.net" in response.text
@@ -139,6 +139,24 @@ def test_public_examples_use_cloudflare_ip_from_private_reverse_proxy(tmp_path:
assert "myip=8.8.4.4" in created.text
def test_pending_examples_use_real_ipv6_when_request_is_ipv6(tmp_path: Path) -> None:
app = make_app(
DdnsSettings(
database_path=tmp_path / "ddns.sqlite3",
admin_password="admin",
hostname_suffix="ddns.example.net",
public_base_url="https://karldns.de",
)
)
client = TestClient(app, client=("2001:4860:4860::8888", 12345))
response = client.post("/")
assert response.status_code == 200
assert "myipv6=2001:4860:4860::8888" in response.text
assert "myip=203.0.113.10" not in response.text
def test_generated_hostname_must_be_activated_before_updates_work(tmp_path: Path) -> None:
database_path = tmp_path / "ddns.sqlite3"
app = make_app(