These are the tests that mock out the IMAP4 object. This assumes that the IMAP calls behave as expected: that the imaplib API does not change and that the behavior of IMAP requests (including Gmail IMAP extensions) does not change. Technically, there should be a second set of tests to ensure that these assumptions remain valid, but those are unlikely to change.
This will require the following:
[ ] Mock(s) for Inbox.connection, probably with 2 emails in it, which should cover the following cases:
[ ] behavior for mock_imap.search is correct for cases where email search string is "ALL" or email search string is "SINCE" with a given time/date string
[ ] behavior for mock_imap.fetch is correct
[ ] Mock(s) for GmailInbox.connection needs the following additional behaviors
[ ] at least one mocked message must have a label
[ ] mock_imap.uid("SEARCH", ...) should give the mock the behavior when searching by unique ID
[ ] mock_imap.uid("STORE", ...) should mock the behavior when setting labels
[ ] mock_imap.search needs to work when given the unique ID for a message
Implementation: Probably a stub class to mock out the necessary behaviors, which allows for subclass stubs?
NB: the incorrect unique ID problem identified in #52 should be fixed before some of these tests (especially around unique ID in Gmail) are implemented.
These are the tests that mock out the
IMAP4
object. This assumes that the IMAP calls behave as expected: that theimaplib
API does not change and that the behavior of IMAP requests (including Gmail IMAP extensions) does not change. Technically, there should be a second set of tests to ensure that these assumptions remain valid, but those are unlikely to change.This will require the following:
Inbox.connection
, probably with 2 emails in it, which should cover the following cases:mock_imap.search
is correct for cases where email search string is "ALL" or email search string is "SINCE" with a given time/date stringmock_imap.fetch
is correctGmailInbox.connection
needs the following additional behaviorsmock_imap.uid("SEARCH", ...)
should give the mock the behavior when searching by unique IDmock_imap.uid("STORE", ...)
should mock the behavior when setting labelsmock_imap.search
needs to work when given the unique ID for a messageImplementation: Probably a stub class to mock out the necessary behaviors, which allows for subclass stubs?
NB: the incorrect unique ID problem identified in #52 should be fixed before some of these tests (especially around unique ID in Gmail) are implemented.