This commit is contained in:
schmeeve
2026-09-23 13:01:22 -07:00
parent 220991de09
commit 35c71a1e6d
4 changed files with 80 additions and 0 deletions

View File

@@ -153,6 +153,24 @@ async def test_history_recorded(client):
assert history[0]["ip"] == "192.168.1.5"
async def test_homepage_stats(client):
await client.post("/api/notes", json={"body": "note one"})
await client.post("/api/notes", json={"body": "note two"})
await client.post(
"/api/attachments",
files={"file": ("a.png", b"abc", "image/png")},
data={"username": "schmeeve"},
)
r = await client.get("/api/homepage")
assert r.status_code == 200
stats = r.json()
assert stats["total_notes"] == 2
assert stats["attachments"] == 1
assert stats["actions"] == 2
assert stats["users"] == 3
async def test_user_selection_cookie(client):
r = await client.post("/api/users/select", json={"username": "ilya"})
assert r.status_code == 200