feat: 首页拆分独立加载、骨架动画和手动刷新

This commit is contained in:
2026-11-15 00:48:26 +08:00
parent 9a6f134f56
commit fa6811dab7
9 changed files with 657 additions and 282 deletions
+9
View File
@@ -96,6 +96,9 @@ def test_admin_login_succeeds_and_wrong_password_skips_euniv() -> None:
assert COOKIE_NAME not in client.cookies
assert client.get("/api/session").json() == {"role": "admin", "username": "admin"}
assert client.get("/api/home").status_code == 403
assert client.get("/api/home/summary").status_code == 403
assert client.get("/api/home/exams").status_code == 403
assert client.get("/api/home/trainings").status_code == 403
assert client.get("/api/exam", params={"path": "/exam/x"}).status_code == 403
assert client.get("/api/training", params={"path": "/plan/x"}).status_code == 403
assert calls == []
@@ -302,6 +305,9 @@ class _Alive:
def credential_alive(self) -> bool:
return True
def month_hours(self) -> str:
return "660"
def export_credential(self) -> dict:
return dict(CREDENTIAL)
@@ -355,6 +361,7 @@ def test_refresh_records_outcome_and_skips_paused_accounts() -> None:
empty = db.get(Account, "empty-user")
assert alive is not None and failed is not None and paused is not None and empty is not None
assert alive.credential_valid is True
assert alive.month_hours == "660"
assert alive.last_refresh_at is not None
assert decrypt_secret(alive.password_cipher) == "secret-pass"
assert json.loads(decrypt_secret(alive.credential_cipher))["yxt_token"] == "yxt-1"
@@ -436,10 +443,12 @@ def test_check_skips_empty_credential_and_updates_saved_one() -> None:
"refresh_paused",
"last_refresh_at",
"credential_valid",
"month_hours",
}
assert saved["has_credential"] is True
assert saved["refresh_paused"] is False
assert saved["credential_valid"] is True
assert saved["month_hours"] == ""
assert isinstance(saved["last_refresh_at"], str)
calls.clear()
again = client.get("/api/admin/users")