feat: 学习进度轮询、学时依据与首页代理弹窗
This commit is contained in:
@@ -642,7 +642,9 @@ def test_settings_do_not_expose_process_switches() -> None:
|
||||
"heartbeat_video_seconds",
|
||||
"heartbeat_document_seconds",
|
||||
"heartbeat_scorm_seconds",
|
||||
"hours_source",
|
||||
}
|
||||
assert body["hours_source"] == "api"
|
||||
assert identity.password_cipher()
|
||||
assert decrypt_secret(identity.password_cipher()) == INITIAL_PASSWORD
|
||||
|
||||
@@ -852,3 +854,16 @@ def test_admin_can_save_study_settings_in_one_request() -> None:
|
||||
assert one["study_start"] == "每月8日 09:10:11"
|
||||
assert one["course_workers"] == 2
|
||||
assert one["proxy"] == "HTTP 10.0.0.8:8080"
|
||||
|
||||
|
||||
def test_admin_can_switch_hours_source() -> None:
|
||||
api = _app()
|
||||
client = TestClient(api.app)
|
||||
assert client.post("/api/login", json={"employee_id": "admin", "password": INITIAL_PASSWORD}).status_code == 200
|
||||
saved = client.put("/api/admin/settings", json=_settings_body(hours_source="history"))
|
||||
assert saved.status_code == 200
|
||||
assert saved.json()["hours_source"] == "history"
|
||||
assert client.get("/api/admin/settings").json()["hours_source"] == "history"
|
||||
bad = client.put("/api/admin/settings", json=_settings_body(hours_source="other"))
|
||||
assert bad.status_code == 400
|
||||
assert bad.json()["detail"] == "学时达标依据须为 api 或 history"
|
||||
|
||||
Reference in New Issue
Block a user