def test_move(self): f1 = Folder(parent=self.account.inbox, name=get_random_string(16)).save() f2 = Folder(parent=self.account.inbox, name=get_random_string(16)).save() f1_id, f1_changekey, f1_parent = f1.id, f1.changekey, f1.parent with self.assertRaises(TypeError) as e: f1.move(to_folder="XXX") # Must be folder instance self.assertEqual( e.exception.args[0], "'to_folder' 'XXX' must be of type (<class 'exchangelib.folders.base.BaseFolder'>, " "<class 'exchangelib.properties.FolderId'>)", ) f1.move(f2) self.assertEqual(f1.id, f1_id) self.assertNotEqual(f1.changekey, f1_changekey) self.assertEqual(f1.parent, f2) self.assertNotEqual(f1.changekey, f1_parent) f1_id, f1_changekey, f1_parent = f1.id, f1.changekey, f1.parent f1.refresh() self.assertEqual(f1.id, f1_id) self.assertEqual(f1.parent, f2) self.assertNotEqual(f1.changekey, f1_parent) f1.delete() f2.delete()
def test_move(self): f1 = Folder(parent=self.account.inbox, name=get_random_string(16)).save() f2 = Folder(parent=self.account.inbox, name=get_random_string(16)).save() f1_id, f1_changekey, f1_parent = f1.id, f1.changekey, f1.parent f1.move(f2) self.assertEqual(f1.id, f1_id) self.assertNotEqual(f1.changekey, f1_changekey) self.assertEqual(f1.parent, f2) f1_id, f1_changekey, f1_parent = f1.id, f1.changekey, f1.parent f1.refresh() self.assertEqual(f1.id, f1_id) self.assertEqual(f1.parent, f2) f1.delete() f2.delete()