def test_get_corresponding_pack_file_object(self, file_name, ex_file_ending, ex_file_detail, corr_pack_object, pack_file_object): assert EnvironmentGuardian.verify_environment() with patch.object(Downloader, "__init__", lambda a, b, c: None): downloader = Downloader('', '') downloader.pack_content = PACK_CONTENT searched_basename = downloader.get_searched_basename(file_name, ex_file_ending, ex_file_detail) corr_file = downloader.get_corresponding_pack_file_object(searched_basename, corr_pack_object) assert ordered(corr_file) == ordered(pack_file_object)
def test_get_corresponding_pack_file_object(self, tmp_path): env = Environment(tmp_path) parameters = [{ 'file_name': 'Test Integration', 'ex_file_ending': 'yml', 'ex_file_detail': 'yaml', 'corr_pack_object': env.INTEGRATION_PACK_OBJECT, 'pack_file_object': env.INTEGRATION_PACK_OBJECT['Test Integration'][2] }, { 'file_name': 'Test Integration', 'ex_file_ending': 'py', 'ex_file_detail': 'python', 'corr_pack_object': env.INTEGRATION_PACK_OBJECT, 'pack_file_object': env.INTEGRATION_PACK_OBJECT['Test Integration'][0] }, { 'file_name': 'Test Integration', 'ex_file_ending': 'png', 'ex_file_detail': 'image', 'corr_pack_object': env.INTEGRATION_PACK_OBJECT, 'pack_file_object': env.INTEGRATION_PACK_OBJECT['Test Integration'][3] }, { 'file_name': 'Test Integration', 'ex_file_ending': 'md', 'ex_file_detail': 'description', 'corr_pack_object': env.INTEGRATION_PACK_OBJECT, 'pack_file_object': env.INTEGRATION_PACK_OBJECT['Test Integration'][5] }, { 'file_name': 'TestScript', 'ex_file_ending': 'yml', 'ex_file_detail': 'yaml', 'corr_pack_object': env.SCRIPT_PACK_OBJECT, 'pack_file_object': env.SCRIPT_PACK_OBJECT['TestScript'][1] }, { 'file_name': 'TestScript', 'ex_file_ending': 'py', 'ex_file_detail': 'python', 'corr_pack_object': env.SCRIPT_PACK_OBJECT, 'pack_file_object': env.SCRIPT_PACK_OBJECT['TestScript'][0] }, { 'file_name': 'Fake Name', 'ex_file_ending': 'py', 'ex_file_detail': 'python', 'corr_pack_object': env.SCRIPT_PACK_OBJECT, 'pack_file_object': {} }] with patch.object(Downloader, "__init__", lambda a, b, c: None): downloader = Downloader('', '') downloader.pack_content = env.PACK_CONTENT for param in parameters: file_name = param['file_name'] ex_file_ending = param['ex_file_ending'] ex_file_detail = param['ex_file_detail'] corr_pack_object = param['corr_pack_object'] pack_file_object = param['pack_file_object'] searched_basename = downloader.get_searched_basename( file_name, ex_file_ending, ex_file_detail) corr_file = downloader.get_corresponding_pack_file_object( searched_basename, corr_pack_object) assert ordered(corr_file) == ordered(pack_file_object)