Admin pages: one shared specification, builders, fragments, caps and live refresh
Adds admin_sections registry, shared admin partials, WorkspaceList, admin CLAUDE.md spec, capped node/flag listings, and api/unit tests enforcing the spec. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,3 +16,37 @@ def test_containers_admin_data_denied_for_non_admin(app_server, seeded_db):
|
||||
)
|
||||
r = s.get(f"{BASE_URL}/admin/containers/data", allow_redirects=False)
|
||||
assert r.status_code in (302, 303, 403)
|
||||
|
||||
|
||||
def test_containers_admin_data_is_paginated(app_server, seeded_db):
|
||||
from devplacepy.database import refresh_snapshot
|
||||
from devplacepy.services.containers import store
|
||||
|
||||
refresh_snapshot()
|
||||
admin = get_table("users").find_one(username=seeded_db["alice"]["username"])
|
||||
uids = []
|
||||
try:
|
||||
for index in range(27):
|
||||
row = store.create_instance(
|
||||
{
|
||||
"project_uid": "proj-admin-page",
|
||||
"name": f"cm-page-{index}",
|
||||
"status": "stopped",
|
||||
"desired_state": "stopped",
|
||||
}
|
||||
)
|
||||
uids.append(row["uid"])
|
||||
headers = {"Accept": "application/json", "X-API-KEY": admin["api_key"]}
|
||||
first = requests.get(f"{BASE_URL}/admin/containers/data", headers=headers).json()
|
||||
assert first["pagination"]["per_page"] == 25
|
||||
assert len(first["instances"]) <= 25
|
||||
second = requests.get(
|
||||
f"{BASE_URL}/admin/containers/data", headers=headers, params={"page": 2}
|
||||
).json()
|
||||
assert not {i["uid"] for i in first["instances"]} & {
|
||||
i["uid"] for i in second["instances"]
|
||||
}
|
||||
finally:
|
||||
table = get_table("instances")
|
||||
for uid in uids:
|
||||
table.delete(uid=uid)
|
||||
|
||||
Reference in New Issue
Block a user