From d4d7d2e62359f5fb9135b195c893c3c8d7fea72a Mon Sep 17 00:00:00 2001 From: grabowski Date: Fri, 23 Oct 2026 10:27:26 +0700 Subject: [PATCH] e2e: find m2 by header fetch --- tests/imap_fixture.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/imap_fixture.py b/tests/imap_fixture.py index e26b4a8..b4247bb 100644 --- a/tests/imap_fixture.py +++ b/tests/imap_fixture.py @@ -79,8 +79,10 @@ def late(): a = old("alice", "alicepass") append(a, "INBOX", msg("late@test", "arrived after the bulk copy")) a.select("INBOX") - typ, data = a.search(None, "HEADER", "Message-ID", "") - a.store(data[0].split()[0], "+FLAGS", r"(\Seen)") + # Find m2 by its header (Stalwart's HEADER search is full-text, not substring). + typ, data = a.fetch("1:*", "(BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])") + seq = next(item[0].split()[0] for item in data if isinstance(item, tuple) and b"" in item[1]) + a.store(seq, "+FLAGS", r"(\Seen)") a.logout()