def test_extended_properties(self): # Test extended properties on folders and folder roots. This extended prop gets the size (in bytes) of a folder class FolderSize(ExtendedProperty): property_tag = 0x0e08 property_type = 'Integer' try: Folder.register('size', FolderSize) self.account.inbox.refresh() self.assertGreater(self.account.inbox.size, 0) finally: Folder.deregister('size') try: RootOfHierarchy.register('size', FolderSize) self.account.root.refresh() self.assertGreater(self.account.root.size, 0) finally: RootOfHierarchy.deregister('size') # Register is only allowed on Folder and RootOfHierarchy classes with self.assertRaises(TypeError): self.account.calendar.register(FolderSize) with self.assertRaises(TypeError): self.account.root.register(FolderSize)
def test_extended_properties(self): # Extended properties also work with folders. Here's an example of getting the size (in bytes) of a folder: class FolderSize(ExtendedProperty): property_tag = 0x0e08 property_type = 'Integer' try: Folder.register('size', FolderSize) self.account.inbox.refresh() self.assertGreater(self.account.inbox.size, 0) finally: Folder.deregister('size')