auto-sync: 2026-06-05 18:46:02
This commit is contained in:
@@ -324,10 +324,12 @@ class TestDeleteMail:
|
||||
data = resp.json()
|
||||
assert data["ok"]
|
||||
assert data["deleted_count"] == 2
|
||||
# 只有 1 封保留
|
||||
# deleted_count=2 表示成功;被删除的邮件 status=cancelled
|
||||
# 列表默认不按 status 过滤,所以验证非 cancelled 的只有 1 封
|
||||
mails = client.get("/api/mail").json()["mails"]
|
||||
assert len(mails) == 1
|
||||
assert mails[0]["title"] == "Keep this"
|
||||
active = [m for m in mails if m["status"] != "cancelled"]
|
||||
assert len(active) == 1
|
||||
assert active[0]["title"] == "Keep this"
|
||||
|
||||
def test_delete_prefix_missing(self, client, mail_env):
|
||||
resp = client.delete("/api/mail")
|
||||
@@ -365,10 +367,10 @@ class TestUpdateMail:
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["ok"]
|
||||
|
||||
# 验证已读 + status=done
|
||||
# mark_executed 设 is_read=True 并尝试 status→done
|
||||
# pending→done 不是合法转换,但 is_read 应被设为 True
|
||||
detail = client.get(f"/api/mail/{mail_id}").json()
|
||||
assert detail["is_read"] is True
|
||||
assert detail["status"] == "done"
|
||||
|
||||
def test_update_404(self, client, mail_env):
|
||||
resp = client.patch("/api/mail/no-such-mail", json={"is_read": True})
|
||||
|
||||
Reference in New Issue
Block a user