feat: 管理端定时日扩到1至28号,学时顺带写回列表
This commit is contained in:
@@ -743,6 +743,16 @@ def test_user_can_set_monthly_study_start(monkeypatch) -> None:
|
||||
assert bad.status_code == 400
|
||||
too_late = client.put("/api/settings/study-start", json={"day": 26, "hour": 16, "minute": 0, "second": 0})
|
||||
assert too_late.status_code == 400
|
||||
with SessionLocal() as db:
|
||||
account = db.get(Account, "6650000146")
|
||||
assert account is not None
|
||||
account.study_start_day = 1
|
||||
db.commit()
|
||||
kept = client.put("/api/settings/study-start", json={"day": 1, "hour": 7, "minute": 0, "second": 0, "enabled": True})
|
||||
assert kept.status_code == 200
|
||||
assert kept.json()["label"] == "每月1日 07:00:00"
|
||||
changed = client.put("/api/settings/study-start", json={"day": 2, "hour": 7, "minute": 0, "second": 0})
|
||||
assert changed.status_code == 400
|
||||
|
||||
|
||||
def _freeze_beijing(monkeypatch, year: int, month: int, day: int) -> None:
|
||||
@@ -1051,6 +1061,10 @@ def test_user_can_read_study_history(monkeypatch) -> None:
|
||||
assert body["items"][0]["minutes"] == 2
|
||||
assert body["hours_source"] == "api"
|
||||
assert body["month_hours"] == "60"
|
||||
with SessionLocal() as db:
|
||||
account = db.get(Account, "6650000146")
|
||||
assert account is not None
|
||||
assert account.month_hours == "60"
|
||||
assert body["year_hours"] == "100"
|
||||
assert body["today_hours"] == 1
|
||||
assert body["total_hours"] == "10"
|
||||
|
||||
Reference in New Issue
Block a user