def test_handle_list_files_flag(self, capsys): with patch.object(Downloader, "__init__", lambda a, b, c: None): downloader = Downloader('', '') downloader.custom_content_temp_dir = CUSTOM_CONTENT_BASE_PATH downloader.list_files = True answer = downloader.handle_list_files_flag() stdout, _ = capsys.readouterr() list_files = [[cco['name'], cco['entity'][:-1]] for cco in CUSTOM_CONTENT] for file in list_files: assert file[0] in stdout assert file[1] in stdout assert answer
def test_handle_list_files_flag_error(self, mocker): """ GIVEN a file contained in custom content of not supported type WHEN the user runs demisto-sdk download -lf THEN the handle_list_files_flag method should ignore the file """ mocker.patch('demisto_sdk.commands.download.downloader.get_dict_from_file', return_value=({}, 'json')) mocker.patch('demisto_sdk.commands.download.downloader.get_child_files', return_value=['path']) with patch.object(Downloader, "__init__", lambda a, b, c: None): downloader = Downloader('', '') downloader.custom_content_temp_dir = INTEGRATION_INSTANCE_PATH downloader.list_files = True assert downloader.handle_list_files_flag()