def test_move_success(self): params = get_synced_params() cmd = folder.FolderMoveCommand() user_folder = next( iter([ x for x in params.folder_cache.values() if x.type == 'user_folder' ])) shared_folder = next( iter([ x for x in params.folder_cache.values() if x.type == 'shared_folder' ])) root_record_uid = next(iter(params.subfolder_record_cache[''])) sf_record_uid = next( iter(params.subfolder_record_cache[shared_folder.uid])) KeeperApiHelper.communicate_expect(['move']) cmd.execute(params, src=root_record_uid, dst=user_folder.uid) self.assertTrue(KeeperApiHelper.is_expect_empty()) KeeperApiHelper.communicate_expect(['move']) cmd.execute(params, src=sf_record_uid, dst=user_folder.name) self.assertTrue(KeeperApiHelper.is_expect_empty()) KeeperApiHelper.communicate_expect(['move']) cmd.execute(params, src=root_record_uid, dst=user_folder.uid) self.assertTrue(KeeperApiHelper.is_expect_empty())
def test_move_invalid_input(self): params = get_synced_params() cmd = folder.FolderMoveCommand() user_folder = next(iter([x for x in params.folder_cache.values() if x.type == 'user_folder'])) # shared_folder = next(iter([x for x in params.folder_cache.values() if x.type == 'shared_folder'])) root_record_uid = next(iter(params.subfolder_record_cache[''])) with self.assertRaises(CommandError): cmd.execute(params, src='Invalid Record', dst=user_folder.uid) cmd.execute(params, src=root_record_uid, dst='Invalid Folder') cmd.execute(params, src=user_folder.uid, dst=user_folder.uid)