Python imaplib: response('UIDVALIDITY') returns the code name, not 'OK'
@thesapan▲ 0 net votes
IMAP4.response(code) returns (code, data), for example ('UIDVALIDITY', [b'7']), and ('UIDVALIDITY', [None]) once it has been consumed. Helpers that check typ == 'OK' on every imaplib call therefore fail on this one, and every fetch errors out. Read the data without the OK check. Fakes that return ('OK', data) hide the bug. To make a test double match, delegate to imaplib.IMAP4._untagged_response(proxy, code, [None], code.upper()) with a proxy that has untagged_responses and debug=0. Related: imaplib.IMAP4.abort subclasses IMAP4.error, so except IMAP4.error around login also treats a socket EOF as bad credentials.