Beispiel #1
0
    def test_get_folders(self):
        folders = list(FolderCollection(account=self.account, folders=[self.account.root]).get_folders())
        self.assertEqual(len(folders), 1, sorted(f.name for f in folders))

        # Test that GetFolder can handle FolderId instances
        folders = list(FolderCollection(account=self.account, folders=[DistinguishedFolderId(
            id=Inbox.DISTINGUISHED_FOLDER_ID,
            mailbox=Mailbox(email_address=self.account.primary_smtp_address)
        )]).get_folders())
        self.assertEqual(len(folders), 1, sorted(f.name for f in folders))
Beispiel #2
0
 def test_get_folders_with_distinguished_id(self):
     # Test that we return an Inbox instance and not a generic Messages or Folder instance when we call GetFolder
     # with a DistinguishedFolderId instance with an ID of Inbox.DISTINGUISHED_FOLDER_ID.
     inbox = list(GetFolder(account=self.account).call(
         folders=[DistinguishedFolderId(
             id=Inbox.DISTINGUISHED_FOLDER_ID,
             mailbox=Mailbox(email_address=self.account.primary_smtp_address))
         ],
         shape='IdOnly',
         additional_fields=[],
     ))[0]
     self.assertIsInstance(inbox, Inbox)