feat: 定时开始日改为每月5到25号,默认8号
This commit is contained in:
@@ -616,12 +616,12 @@ def test_user_can_set_monthly_study_start() -> None:
|
||||
empty = client.get("/api/settings/study-start")
|
||||
assert empty.status_code == 200
|
||||
assert empty.json() == {
|
||||
"day": 1,
|
||||
"day": 8,
|
||||
"hour": 0,
|
||||
"minute": 0,
|
||||
"second": 0,
|
||||
"enabled": True,
|
||||
"label": "每月1日 00:00:00",
|
||||
"label": "每月8日 00:00:00",
|
||||
}
|
||||
saved = client.put("/api/settings/study-start", json={"day": 5, "hour": 16, "minute": 0, "second": 7, "enabled": False})
|
||||
assert saved.status_code == 200
|
||||
@@ -629,8 +629,10 @@ def test_user_can_set_monthly_study_start() -> None:
|
||||
assert saved.json()["enabled"] is False
|
||||
again = client.put("/api/settings/study-start", json={"day": 5, "hour": 16, "minute": 0, "second": 7, "enabled": True})
|
||||
assert again.json()["enabled"] is True
|
||||
bad = client.put("/api/settings/study-start", json={"day": 32, "hour": 16, "minute": 0, "second": 0})
|
||||
bad = client.put("/api/settings/study-start", json={"day": 4, "hour": 16, "minute": 0, "second": 0})
|
||||
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
|
||||
|
||||
|
||||
def _freeze_beijing(monkeypatch, year: int, month: int, day: int) -> None:
|
||||
@@ -656,7 +658,7 @@ def test_user_can_start_and_stop_study_immediately(monkeypatch) -> None:
|
||||
client = TestClient(api_module.app)
|
||||
_freeze_beijing(monkeypatch, 2026, 11, 15)
|
||||
assert client.post("/api/login", json={"employee_id": "6650000146", "password": "secret-pass"}).status_code == 200
|
||||
client.put("/api/settings/study-start", json={"day": 31, "hour": 23, "minute": 59, "second": 59})
|
||||
client.put("/api/settings/study-start", json={"day": 25, "hour": 23, "minute": 59, "second": 59})
|
||||
idle = client.get("/api/settings/study-control")
|
||||
assert idle.status_code == 200
|
||||
assert idle.json()["workers"] == []
|
||||
@@ -714,7 +716,7 @@ def test_study_control_websocket_sends_snapshot(monkeypatch) -> None:
|
||||
ws.receive_json()
|
||||
assert closed.value.code == 4401
|
||||
assert client.post("/api/login", json={"employee_id": "6650000146", "password": "secret-pass"}).status_code == 200
|
||||
client.put("/api/settings/study-start", json={"day": 31, "hour": 23, "minute": 59, "second": 59})
|
||||
client.put("/api/settings/study-start", json={"day": 25, "hour": 23, "minute": 59, "second": 59})
|
||||
with client.websocket_connect("/api/settings/study-control/ws") as ws:
|
||||
data = ws.receive_json()
|
||||
assert data["started"] is False
|
||||
|
||||
Reference in New Issue
Block a user