コード例 #1
0
 def test_folder_query_set_failures(self):
     with self.assertRaises(TypeError) as e:
         FolderQuerySet("XXX")
     self.assertEqual(
         e.exception.args[0],
         "'folder_collection' 'XXX' must be of type <class 'exchangelib.folders.collections.FolderCollection'>",
     )
     # Test FolderQuerySet._copy_cls()
     self.assertEqual(list(FolderQuerySet(FolderCollection(account=self.account, folders=[])).only("name")), [])
     fld_qs = SingleFolderQuerySet(account=self.account, folder=self.account.inbox)
     with self.assertRaises(InvalidField) as e:
         fld_qs.only("XXX")
     self.assertIn("Unknown field 'XXX' on folders", e.exception.args[0])
     with self.assertRaises(InvalidField) as e:
         list(fld_qs.filter(XXX="XXX"))
     self.assertIn("Unknown field path 'XXX' on folders", e.exception.args[0])
コード例 #2
0
 def test_folder_query_set_failures(self):
     with self.assertRaises(ValueError):
         FolderQuerySet('XXX')
     fld_qs = SingleFolderQuerySet(account=self.account, folder=self.account.inbox)
     with self.assertRaises(InvalidField):
         fld_qs.only('XXX')
     with self.assertRaises(InvalidField):
         list(fld_qs.filter(XXX='XXX'))