diff --git a/tests/imap_fixture.py b/tests/imap_fixture.py index a929496..57bc4b9 100644 --- a/tests/imap_fixture.py +++ b/tests/imap_fixture.py @@ -94,9 +94,12 @@ def inspect(user, password): boxes.append(m.group(3).decode()) out = {"boxes": boxes, "folders": {}} for b in boxes: - typ, _ = c.select(f'"{b}"', readonly=True) + typ, count = c.select(f'"{b}"', readonly=True) if typ != "OK": continue + if int(count[0]) == 0: # Dovecot answers FETCH 1:* on an empty box with BAD + out["folders"][b] = [] + continue typ, data = c.fetch("1:*", "(FLAGS INTERNALDATE RFC822.SIZE BODY.PEEK[HEADER.FIELDS (MESSAGE-ID SUBJECT)])") msgs = [] for item in data: