Archived
Simplify DDNS flow and polish UI
This commit is contained in:
1 parent
5beee0e5c6
commit
5a90bd9d87
42 files changed
+587
-1418
No files matched your search
+4
-18
@@ -6,20 +6,8 @@ from router_dyndns.ddns import DdnsSettings, DdnsStore, make_app
|
||||
from router_dyndns.ddns_security import admin_csrf_token
|
||||
|
||||
|
||||
def test_shared_secret_is_not_admin_password_fallback(tmp_path: Path) -> None:
|
||||
app = make_app(DdnsSettings(database_path=tmp_path / "ddns.sqlite3", shared_secret="secret"))
|
||||
client = TestClient(app)
|
||||
|
||||
response = client.get("/admin", auth=("admin", "secret"))
|
||||
|
||||
assert response.status_code == 500
|
||||
assert response.json()["detail"] == "DDNS_ADMIN_PASSWORD is required"
|
||||
|
||||
|
||||
def test_admin_page_shows_operator_views_without_create_form(tmp_path: Path) -> None:
|
||||
database_path = tmp_path / "ddns.sqlite3"
|
||||
store = DdnsStore(database_path)
|
||||
store.create_domain_challenge("example.net")
|
||||
app = make_app(DdnsSettings(database_path=database_path, admin_password="admin"))
|
||||
client = TestClient(app)
|
||||
|
||||
@@ -32,10 +20,10 @@ def test_admin_page_shows_operator_views_without_create_form(tmp_path: Path) ->
|
||||
assert "Operator console" in response.text
|
||||
assert "Generate credentials" not in response.text
|
||||
assert 'action="/admin/accounts"' not in response.text
|
||||
assert response.text.count("data-admin-table") == 3
|
||||
assert response.text.count("data-table-search") == 3
|
||||
assert response.text.count("data-table-page-size") == 3
|
||||
assert response.text.count("data-table-pagination") == 3
|
||||
assert response.text.count("data-admin-table") == 2
|
||||
assert response.text.count("data-table-search") == 2
|
||||
assert response.text.count("data-table-page-size") == 2
|
||||
assert response.text.count("data-table-pagination") == 2
|
||||
assert "admin-table-scroll" in response.text
|
||||
assert "Cleanup" in response.text
|
||||
assert "Run now" in response.text
|
||||
@@ -43,9 +31,7 @@ def test_admin_page_shows_operator_views_without_create_form(tmp_path: Path) ->
|
||||
assert "Metrics" in response.text
|
||||
assert "Blocked requests" in response.text
|
||||
assert "Hostnames" in response.text
|
||||
assert "Domain claims" in response.text
|
||||
assert "Update events" in response.text
|
||||
assert "example.net" in response.text
|
||||
|
||||
|
||||
def test_custom_admin_path_moves_operator_routes(tmp_path: Path) -> None:
|
||||
|
||||
Reference in new issue
Block a user