def test_explicit_cancel_closes_shared_episode_without_native_io(self): coordinator = self.use_real_coordinator() self.bot._forget_uncertain_tracking = mock.Mock() result = self.bot.cancel_pending_replies([self.key]) self.assertEqual(result['deleted'], [self.key]) self.assertFalse(coordinator.has_pending('S:1_2')) self.assertFalse(coordinator.resumed('S:1_2')) def test_explicit_handoff_closes_shared_episode_without_approval(self): coordinator = self.use_real_coordinator() result = self.bot.handoff_pending_replies([self.key]) self.assertEqual(result['handed_off'], [self.key]) self.assertFalse(coordinator.has_pending('S:1_2')) self.assertFalse(coordinator.resumed('S:1_2')) def test_failed_queue_cancel_keeps_shared_episode(self): coordinator = self.use_real_coordinator() self.bot._forget_uncertain_tracking = mock.Mock() with mock.patch.object(self.bot, '_persist_pending_replies_unlocked', return_value=False): result = self.bot.cancel_pending_replies([self.key]) self.assertFalse(result['deleted']) self.assertTrue(coordinator.has_pending('S:1_2')) def test_stopped_client_cancel_closes_reminder_in_queue_data_directory(self): from gui_runtime import delete_pending_reply_file coordinator = self.use_real_coordinator() with mock.patch('queue_log.QueueLog'): result = delete_pending_reply_file([self.key], self.bot._pending_reply_path) self.assertEqual(result['deleted'], [self.key]) self.assertFalse(coordinator.has_pending('S:1_2')) def test_failed_reminder_cancel_is_reported_without_claiming_success(self): from gui_runtime import cancel_assistant_review_for_state with mock.patch('review_assistant.ReviewAssistantCoordinator') as factory, mock.patch('builtins.print') as log: factory.return_value.cancel_review.return_value = False self.assertFalse(cancel_assistant_review_for_state({'account':'123', 'assistant_review_id':'r'}, self.root)) self.assertTrue(log.called)