Пример #1
0
    def test_count_mail(self):
        mailbox = ImapMailbox.from_bytes_with_connector(
            self.connector, b'(\\HasNoChildren \\Marked) "/" "GitHub"')

        mailbox.select()

        assert mailbox.count_mail == 3
Пример #2
0
    def test_search_mail_unkown(self):
        mailbox = ImapMailbox.from_bytes_with_connector(
            self.connector, b'(\\HasNoChildren \\Marked) "/" "GitHub"')

        mailbox.select()

        mails = mailbox.search_mail(
            charset=None, criterion=["(FROM \"[email protected]\")"])

        assert len(mails) == 0
Пример #3
0
    def test_search_mail(self):
        mailbox = ImapMailbox.from_bytes_with_connector(
            self.connector, b'(\\HasNoChildren \\Marked) "/" "GitHub"')

        mailbox.select()

        mails = mailbox.search_mail(
            charset=None, criterion=["(FROM \"[email protected]\")"])

        assert len(mails) == 1
Пример #4
0
  def list_mailbox(self, **kwargs):
    res, data = self.connection.list(**kwargs)

    if res == 'NO':
      raise ConnectorError(data)

    if data == [None]:
      return []

    return [ImapMailbox.from_bytes_with_connector(self, el) for el in data]
Пример #5
0
    def test_list_mailbox_from_mailbox(self):
        mailbox = ImapMailbox.from_bytes_with_connector(
            self.connector, b'(\\HasNoChildren \\Marked) "/" "GitHub"')

        mailboxes = mailbox.list_mailbox()

        mailboxes = mailboxes[0].list_mailbox()

        assert len(mailboxes) > 0

        assert mailboxes[0].name == "Actions"
        assert mailboxes[0].location == "GitHub.CI"
Пример #6
0
    def setup_method(self):
        load_dotenv()

        connector = ConnectorFactory.get_connector('imap')(
            ssl=False,
            host=os.environ.get('TEST_IMAP_HOST'),
            port=os.environ.get('TEST_IMAP_PORT'))

        connector.login(user=os.environ.get('TEST_IMAP_USERNAME'),
                        password=os.environ.get('TEST_IMAP_PASSWORD'))

        self.mailbox = ImapMailbox.from_bytes_with_connector(
            connector, b'(\\HasNoChildren \\Marked) "/" "GitHub"')

        self.mailbox.select()
Пример #7
0
    def test_from_bytes_connector(self):
        mailbox = ImapMailbox.from_bytes_with_connector(
            self.connector, b'(\\HasNoChildren \\Marked) "/" "INBOX"')

        assert mailbox.__class__ is ImapMailbox
        assert mailbox.connector == self.connector