新增网站值班确认和按钮测试邮件入口,修复活动邮件跨站确认

This commit is contained in:
2026-11-06 16:52:51 +08:00
parent 7584f5232e
commit 6377a42a8f
10 changed files with 292 additions and 20 deletions
+6 -2
View File
@@ -124,7 +124,9 @@ class NotifyTests(unittest.IsolatedAsyncioTestCase):
async with self.sessions() as db:
people = await self.m._require_participant(db, self.m_activity_id, bob["user"]["id"])
self.assertIsNone(people)
r = await c.post(f"/join/{token}")
import re
nonce = re.search(r'name="confirmation_token" value="([^"]+)"', r.text).group(1)
r = await c.post(f"/join/{token}", data={'confirmation_token': nonce}, headers={'Origin': 'null', 'Sec-Fetch-Site': 'cross-site'})
self.assertIn("记录成功", r.text)
self.assertIn("客户答谢会", r.text)
@@ -142,7 +144,9 @@ class NotifyTests(unittest.IsolatedAsyncioTestCase):
# 丙的链接仍可用(每人一个独立 token)
carol_url = self.join_url(mail_to("c@example.test"))
r = await c.post(carol_url)
page = await c.get(carol_url)
nonce = re.search(r'name="confirmation_token" value="([^"]+)"', page.text).group(1)
r = await c.post(carol_url, data={'confirmation_token': nonce})
self.assertIn("记录成功", r.text)
async def test_private_activity_no_notify(self):