feat: 每月定时开始学习并改为本地计算心跳摘要
This commit is contained in:
@@ -117,6 +117,10 @@ def test_login_stores_password_and_credential_only() -> None:
|
||||
"proxy_port",
|
||||
"proxy_username",
|
||||
"proxy_password_cipher",
|
||||
"study_start_day",
|
||||
"study_start_hour",
|
||||
"study_start_minute",
|
||||
"study_start_second",
|
||||
}
|
||||
|
||||
home = client.get("/api/home")
|
||||
@@ -488,6 +492,25 @@ def test_user_can_set_proxy_with_or_without_password() -> None:
|
||||
assert cleared.json()["enabled"] is False
|
||||
|
||||
|
||||
def test_user_can_set_monthly_study_start() -> None:
|
||||
import euniv.api as api_module
|
||||
import euniv.service as service_module
|
||||
|
||||
api_module.login_and_store = lambda db, employee_id, password, manual=False, auto_attempts=3: service_module.login_and_store(
|
||||
db, employee_id, password, FakeClient, manual=manual, auto_attempts=auto_attempts
|
||||
)
|
||||
client = TestClient(api_module.app)
|
||||
assert client.post("/api/login", json={"employee_id": "6650000146", "password": "secret-pass"}).status_code == 200
|
||||
empty = client.get("/api/settings/study-start")
|
||||
assert empty.status_code == 200
|
||||
assert empty.json() == {"day": 1, "hour": 0, "minute": 0, "second": 0, "label": "每月1日 00:00:00"}
|
||||
saved = client.put("/api/settings/study-start", json={"day": 5, "hour": 16, "minute": 0, "second": 7})
|
||||
assert saved.status_code == 200
|
||||
assert saved.json()["label"] == "每月5日 16:00:07"
|
||||
bad = client.put("/api/settings/study-start", json={"day": 32, "hour": 16, "minute": 0, "second": 0})
|
||||
assert bad.status_code == 400
|
||||
|
||||
|
||||
def test_exam_list_rejects_unrecognized_page() -> None:
|
||||
from euniv.client import EunivClient
|
||||
|
||||
|
||||
Reference in New Issue
Block a user