fix: thread/unarchive 不再预 resume(已归档 thread 直接调 thread/unarchive)

This commit is contained in:
host committed 2026-10-28 08:33:04 +08:00
1 parent 5c9beb8a6d
commit f186c60e4e
2 files changed
+20 -3

No files matched your search

+16 -2
View File
@@ -151,7 +151,7 @@ class ThreadCliTest(unittest.TestCase):
calls = self._calls_before_close(fake)
self.assertEqual(calls, [("archive", "th-1")])
def test_unarchive_resume_first(self):
def test_unarchive_no_resume(self):
fake = FakeServer()
code, out, _ = self._run(
fake, ["thread-unarchive", "--thread-id", "th-1"])
@@ -159,7 +159,21 @@ class ThreadCliTest(unittest.TestCase):
self.assertEqual(json.loads(out), {"thread": {"id": "th-1"}})
calls = self._calls_before_close(fake)
self.assertEqual(calls, [
("resume", "th-1"),
("request", "thread/unarchive", {"threadId": "th-1"}),
])
def test_unarchive_resume_failure_does_not_block(self):
# 回归:已归档 thread 的 resume 会失败;unarchive 不再调
# resume,所以 resume 失败也不应挡住 unarchive(此前
# resume 抛错 → CLI 退出 1 → 服务端回 502)。
fake = FakeServer()
fake.resume_error = True
code, out, _ = self._run(
fake, ["thread-unarchive", "--thread-id", "th-1"])
self.assertEqual(code, 0)
self.assertEqual(json.loads(out), {"thread": {"id": "th-1"}})
calls = self._calls_before_close(fake)
self.assertEqual(calls, [
("request", "thread/unarchive", {"threadId": "th-1"}),
])