feat: enforce Mail-owned campaign transport boundary
This commit is contained in:
@@ -247,6 +247,22 @@ class ImapMailboxCommandTests(unittest.TestCase):
|
||||
self.assertEqual(result.folder, "Gesendete Elemente")
|
||||
self.assertEqual(result.bytes_appended, len(b"Subject: test\r\n\r\nBody"))
|
||||
|
||||
def test_connection_loss_after_append_starts_has_unknown_outcome(self):
|
||||
class Client:
|
||||
def append(self, _mailbox, _flags, _date_time, _message):
|
||||
raise OSError("provider detail")
|
||||
|
||||
def logout(self):
|
||||
return "BYE", [b"logged out"]
|
||||
|
||||
config = ImapConfig(host="imap.example.org", username="user", password="secret", sent_folder="Sent")
|
||||
with patch("govoplan_mail.backend.sending.imap._open_imap", return_value=Client()):
|
||||
with self.assertRaises(ImapAppendError) as captured:
|
||||
append_message_to_sent(b"Subject: test\r\n\r\nBody", imap_config=config, folder="Sent")
|
||||
|
||||
self.assertTrue(captured.exception.outcome_unknown)
|
||||
self.assertFalse(captured.exception.temporary)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user