feat: show current duty students and shift countdown on activity wall
This commit is contained in:
@@ -89,6 +89,21 @@ class ApiTestCase(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
|
||||
class WorkLogApiTests(ApiTestCase):
|
||||
async def test_wall_duty_requires_login_and_only_exposes_schedule(self):
|
||||
from datetime import datetime
|
||||
from server.duty import BEIJING
|
||||
c = self.client
|
||||
self.assertEqual((await c.get("/api/duty/current")).status_code, 401)
|
||||
u = await register(c, "dutyviewer")
|
||||
with patch.object(self.m, "datetime") as clock:
|
||||
clock.now.return_value = datetime(2026, 11, 6, 8, 30, tzinfo=BEIJING)
|
||||
r = await c.get("/api/duty/current", headers=auth(u["token"]))
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertEqual(r.json()["current"]["names"], ["华秋豪"])
|
||||
self.assertEqual(r.json()["current"]["end_at"] - r.json()["current"]["start_at"], 105 * 60000)
|
||||
self.assertNotIn("email", r.text)
|
||||
self.assertNotIn("phone", r.text)
|
||||
|
||||
# ------------------------------------------------------------- 账号
|
||||
async def test_register_login_profile(self):
|
||||
c = self.client
|
||||
|
||||
Reference in New Issue
Block a user