Skip to content

Tests for Inbox (offline tests) #30

Description

@dwhswenson

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions