Archived
Allow registration before first IP update
This commit is contained in:
1 parent
9f5cee8a0e
commit
c19e5170a0
5 files changed
+29
-20
No files matched your search
+13
-5
@@ -273,8 +273,9 @@ def test_registration_publishes_initial_dns_when_provider_is_configured(tmp_path
|
||||
assert published[0].ipv4 == "203.0.113.77"
|
||||
|
||||
|
||||
def test_registration_requires_ip_when_provider_source_ip_is_not_public(tmp_path: Path, monkeypatch) -> None:
|
||||
monkeypatch.setattr(ddns_module, "publish_dns", lambda result, settings: None)
|
||||
def test_registration_without_public_source_ip_waits_for_first_router_update(tmp_path: Path, monkeypatch) -> None:
|
||||
published = []
|
||||
monkeypatch.setattr(ddns_module, "publish_dns", lambda result, settings: published.append(result))
|
||||
app = make_app(
|
||||
DdnsSettings(
|
||||
database_path=tmp_path / "ddns.sqlite3",
|
||||
@@ -289,12 +290,19 @@ def test_registration_requires_ip_when_provider_source_ip_is_not_public(tmp_path
|
||||
client = TestClient(app)
|
||||
|
||||
body = client.post("/api/v1/hostnames").json()
|
||||
update_path = _path(body["update_url"])
|
||||
registered = client.post(_path(body["registration_url"]))
|
||||
status = client.get(f"/api/v1/hostnames/{body['dashboard_url'].rsplit('/', 1)[1]}")
|
||||
update = client.get(update_path, params={"myip": "203.0.113.80"})
|
||||
|
||||
assert registered.status_code == 400
|
||||
assert registered.text.startswith("badip registration needs a public source IP")
|
||||
assert status.json()["status"] == "pending"
|
||||
assert registered.status_code == 200
|
||||
assert registered.text == "good registered"
|
||||
assert status.json()["status"] == "active"
|
||||
assert status.json()["ipv4"] is None
|
||||
assert update.status_code == 200
|
||||
assert update.text == "good 203.0.113.80"
|
||||
assert len(published) == 1
|
||||
assert published[0].ipv4 == "203.0.113.80"
|
||||
|
||||
|
||||
def test_api_update_publishes_before_recording_ip(tmp_path: Path, monkeypatch) -> None:
|
||||
|
||||
Reference in new issue
Block a user