test: fix code and test

This commit is contained in:
Christophe Chauvet
2026-01-13 22:00:37 +01:00
parent bef732dfd8
commit b92ebf1aa4
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -301,10 +301,11 @@ class IMAPconnector:
key = "SUBJECT"
else:
continue
if pattern:
criterions = or_criterion(criterions, f'({key} "{pattern}")')
else:
criterions = "ALL"
criterions = or_criterion(criterions, f'({key} "{pattern}")')
if not pattern:
criterions = "ALL"
self.criterions = [bytearray(criterions, "utf8")]
def messages_count(self, **kwargs) -> int:
+1 -1
View File
@@ -16,7 +16,7 @@ class ImapUtilsTestCase(unittest.TestCase):
"""Test with Criterion and pattern"""
self.imap_connector.criterions = []
self.imap_connector.parse_search_parameters("from_addr", "bob")
result = [bytearray('FROM "bob"', "utf8")]
result = [bytearray('(FROM "bob")', "utf8")]
self.assertEqual(self.imap_connector.criterions, result)
def test_criterions_one_criterion_without_pattern(self):