Fence Mail provider and mailbox recovery effects
This commit is contained in:
@@ -19,6 +19,7 @@ from govoplan_mail.backend.sending.imap import (
|
||||
_sequence_set,
|
||||
append_message_to_sent,
|
||||
list_imap_messages,
|
||||
list_imap_uids_since,
|
||||
)
|
||||
|
||||
|
||||
@@ -207,6 +208,39 @@ class ImapMessagePaginationTests(unittest.TestCase):
|
||||
|
||||
|
||||
class ImapMailboxCommandTests(unittest.TestCase):
|
||||
def test_watcher_lists_new_uids_oldest_first(self):
|
||||
class Client:
|
||||
def uid(self, command, _charset, criterion):
|
||||
self.search = (command, criterion)
|
||||
return "OK", [b"5 9 7"]
|
||||
|
||||
def logout(self):
|
||||
return "BYE", [b"logged out"]
|
||||
|
||||
client = Client()
|
||||
config = ImapConfig(
|
||||
host="imap.example.org",
|
||||
username="user",
|
||||
password="secret",
|
||||
)
|
||||
with (
|
||||
patch("govoplan_mail.backend.sending.imap._open_imap", return_value=client),
|
||||
patch(
|
||||
"govoplan_mail.backend.sending.imap._select_readonly",
|
||||
return_value=(3, "42"),
|
||||
),
|
||||
):
|
||||
result = list_imap_uids_since(
|
||||
imap_config=config,
|
||||
folder="INBOX",
|
||||
highest_uid=6,
|
||||
expected_uidvalidity="42",
|
||||
limit=2,
|
||||
)
|
||||
|
||||
self.assertEqual(["7", "9"], result.uids)
|
||||
self.assertEqual(("search", "ALL"), client.search)
|
||||
|
||||
def test_select_quotes_mailbox_name_with_spaces(self):
|
||||
class Client:
|
||||
untagged_responses = {"EXISTS": [b"0"], "UIDVALIDITY": [b"1"]}
|
||||
|
||||
Reference in New Issue
Block a user