diff --git a/demisto_sdk/commands/common/hook_validations/base_validator.py b/demisto_sdk/commands/common/hook_validations/base_validator.py index 5377f58395b..ebd3732af43 100644 --- a/demisto_sdk/commands/common/hook_validations/base_validator.py +++ b/demisto_sdk/commands/common/hook_validations/base_validator.py @@ -8,8 +8,8 @@ StructureValidator from demisto_sdk.commands.common.tools import (_get_file_id, get_latest_release_notes_text, - get_not_registered_tests, get_release_notes_file_path, + is_test_config_match, print_error, run_command) @@ -130,18 +130,7 @@ def _load_conf_file(self): with open(self.CONF_PATH) as data_file: return json.load(data_file) - def are_tests_configured(self) -> bool: - """ - Checks if a file (playbook or integration) has a TestPlaybook and if the TestPlaybook is configured in conf.json - And prints an error message accordingly - """ - file_type = self.structure_validator.scheme_name - tests = self.current_file.get('tests', []) - if not self.yml_has_test_key(tests, file_type): - return False - return self.tests_registered_in_conf_json_file(tests) - - def tests_registered_in_conf_json_file(self, test_playbooks: list) -> bool: + def are_tests_registered_in_conf_json_file(self, test_playbooks: list) -> bool: """ Checking if test playbooks are configured in 'conf.json' unless 'No tests' is in test playbooks. If 'No tests' is not in test playbooks and there is a test playbook that is not configured: Will print's @@ -155,26 +144,43 @@ def tests_registered_in_conf_json_file(self, test_playbooks: list) -> bool: no_tests_explicitly = any(test for test in test_playbooks if 'no test' in test.lower()) if no_tests_explicitly: return True + conf_json_tests = self._load_conf_file()['tests'] content_item_id = _get_file_id(self.structure_validator.scheme_name, self.current_file) file_type = self.structure_validator.scheme_name - not_registered_tests = get_not_registered_tests(conf_json_tests, content_item_id, file_type, test_playbooks) - if not_registered_tests: - file_type = self.structure_validator.scheme_name - if file_type == 'integration': - missing_test_configurations = json.dumps([ - {'integrations': content_item_id, 'playbookID': test} for test in not_registered_tests - ], indent=4).strip('[]') - else: - missing_test_configurations = json.dumps([ - {'playbookID': test} for test in not_registered_tests - ], indent=4).strip('[]') - error_message = \ - f'The following TestPlaybooks are not registered in {self.CONF_PATH} file.\n' \ - f'Please add\n{missing_test_configurations}\nto {self.CONF_PATH} path under \'tests\' key.' - print_error(error_message) - return False + # Test playbook case + + if 'TestPlaybooks' in self.file_path and file_type == 'playbook': + is_configured_test = any(test_config for test_config in conf_json_tests if + is_test_config_match(test_config, test_playbook_id=content_item_id)) + if not is_configured_test: + missing_test_playbook_configurations = json.dumps({'playbookID': content_item_id}, indent=4) + missing_integration_configurations = json.dumps( + {'integrations': '', 'playbookID': content_item_id}, + indent=4) + error_message = \ + f'The TestPlaybook {content_item_id} is not registered in {self.CONF_PATH} file.\n' \ + f'Please add\n{missing_test_playbook_configurations}\n' \ + f'or if this test playbook is for an integration\n{missing_integration_configurations}\n' \ + f'to {self.CONF_PATH} path under \'tests\' key.' + print_error(error_message) + return False + + # Integration case + elif file_type == 'integration': + is_configured_test = any( + test_config for test_config in conf_json_tests if is_test_config_match(test_config, + integration_id=content_item_id)) + if not is_configured_test: + missing_test_playbook_configurations = json.dumps( + {'integrations': content_item_id, 'playbookID': ''}, + indent=4) + error_message = \ + f'The following TestPlaybooks are not registered in {self.CONF_PATH} file.\n' \ + f'Please add\n{missing_test_playbook_configurations}\nto {self.CONF_PATH} path under \'tests\' key.' + print_error(error_message) + return False return True def yml_has_test_key(self, test_playbooks: list, file_type: str) -> bool: @@ -183,7 +189,7 @@ def yml_has_test_key(self, test_playbooks: list, file_type: str) -> bool: If not: prints an error message according to the file type and return the check result Args: test_playbooks: The yml file's list of test playbooks - file_type: The file type, could be a script, an integration or a playbook. + file_type: The file type, could be an integration or a playbook. Returns: True if tests are configured (not None and not an empty list) otherwise return False. diff --git a/demisto_sdk/commands/common/hook_validations/integration.py b/demisto_sdk/commands/common/hook_validations/integration.py index 17d7cf67dc2..805fc28727e 100644 --- a/demisto_sdk/commands/common/hook_validations/integration.py +++ b/demisto_sdk/commands/common/hook_validations/integration.py @@ -84,6 +84,17 @@ def is_valid_file(self, validate_rn: bool = True) -> bool: ] return all(answers) + def are_tests_configured(self) -> bool: + """ + Checks if the integration has a TestPlaybook and if the TestPlaybook is configured in conf.json + And prints an error message accordingly + """ + file_type = self.structure_validator.scheme_name + tests = self.current_file.get('tests', []) + if not self.are_tests_registered_in_conf_json_file(tests): + return self.yml_has_test_key(tests, file_type) + return True + def is_valid_beta_integration(self, validate_rn: bool = True) -> bool: """Check whether the beta Integration is valid or not, update the _is_valid field to determine that Args: diff --git a/demisto_sdk/commands/common/hook_validations/playbook.py b/demisto_sdk/commands/common/hook_validations/playbook.py index bd3c83230c6..c72b2027d2f 100644 --- a/demisto_sdk/commands/common/hook_validations/playbook.py +++ b/demisto_sdk/commands/common/hook_validations/playbook.py @@ -43,6 +43,18 @@ def is_valid_playbook(self, is_new_playbook: bool = True, validate_rn: bool = Tr return answers + def are_tests_configured(self) -> bool: + """ + Checks if the playbook has a TestPlaybook and if the TestPlaybook is configured in conf.json + And prints an error message accordingly + """ + if 'TestPlaybooks' in self.file_path: + return True + + file_type = self.structure_validator.scheme_name + tests = self.current_file.get('tests', []) + return self.yml_has_test_key(tests, file_type) + def is_id_equals_name(self): # type: () -> bool """Check whether the playbook ID is equal to its name. diff --git a/demisto_sdk/commands/common/hook_validations/script.py b/demisto_sdk/commands/common/hook_validations/script.py index 7c2bed00014..6acd2e8750c 100644 --- a/demisto_sdk/commands/common/hook_validations/script.py +++ b/demisto_sdk/commands/common/hook_validations/script.py @@ -62,7 +62,6 @@ def is_valid_file(self, validate_rn=True): self.is_id_equals_name(), self.is_docker_image_valid(), self.is_valid_pwsh(), - self.are_tests_configured() ]) # check only on added files if not self.old_file: diff --git a/demisto_sdk/commands/common/tests/base_validator_test.py b/demisto_sdk/commands/common/tests/base_validator_test.py index 5ce61d83017..748774a1d39 100644 --- a/demisto_sdk/commands/common/tests/base_validator_test.py +++ b/demisto_sdk/commands/common/tests/base_validator_test.py @@ -3,11 +3,11 @@ BaseValidator from demisto_sdk.commands.common.hook_validations.structure import \ StructureValidator -from demisto_sdk.commands.common.tools import (find_test_match, - get_not_registered_tests) +from demisto_sdk.commands.common.tools import (get_not_registered_tests, + is_test_config_match) from demisto_sdk.tests.constants_test import ( - INVALID_INTEGRATION_WITH_NO_TEST_PLAYBOOK, SCRIPT_WITH_PLAYBOOK, - VALID_INTEGRATION_TEST_PATH, VALID_TEST_PLAYBOOK_PATH) + INVALID_INTEGRATION_WITH_NO_TEST_PLAYBOOK, VALID_INTEGRATION_TEST_PATH, + VALID_TEST_PLAYBOOK_PATH) HAS_TESTS_KEY_UNPUTS = [ (VALID_INTEGRATION_TEST_PATH, 'integration', True), @@ -63,27 +63,13 @@ def test_yml_has_test_key(file_path, schema, expected): 'integration', False ), - ( - {'integrations': ['integration1', 'integration2'], 'playbookID': 'playbook1'}, - 'integration1', - 'playbook2', - 'integration', - False - ), ( {'playbookID': 'playbook1'}, - 'playbook', + '', 'playbook1', 'playbook', True ), - ( - {'playbookID': 'playbook1'}, - 'some-script', - 'playbook1', - 'script', - True - ), ] @@ -101,7 +87,7 @@ def test_find_test_match(test_config, integration_id, test_playbook_id, expected Then - Ensure the method 'find_test_match' return answer accordingly """ - assert find_test_match(test_config, test_playbook_id, integration_id, file_type) == expected + assert is_test_config_match(test_config, test_playbook_id, integration_id) == expected NOT_REGISTERED_TESTS_INPUT = [ @@ -123,7 +109,7 @@ def test_find_test_match(test_config, integration_id, test_playbook_id, expected VALID_INTEGRATION_TEST_PATH, 'integration', [{'integrations': 'PagerDuty v2', 'playbookID': 'Playbook'}], - 'PagerDuty v2', + 'PagerDuty v3', ['PagerDuty Test'] ), ( @@ -140,21 +126,6 @@ def test_find_test_match(test_config, integration_id, test_playbook_id, expected 'Account Enrichment', ['PagerDuty Test'] ), - ( - SCRIPT_WITH_PLAYBOOK, - 'script', - [{'integrations': 'TestCreateDuplicates', 'playbookID': 'PagerDuty Test'}], - 'TestCreateDuplicates', - [] - ), - ( - SCRIPT_WITH_PLAYBOOK, - 'script', - [{'integrations': 'TestCreateDuplicates', 'playbookID': 'other test'}], - 'TestCreateDuplicates', - ['PagerDuty Test'] - ) - ] diff --git a/demisto_sdk/commands/common/tools.py b/demisto_sdk/commands/common/tools.py index de22b9356bf..eec6429f658 100644 --- a/demisto_sdk/commands/common/tools.py +++ b/demisto_sdk/commands/common/tools.py @@ -807,33 +807,41 @@ def get_depth(data: Any) -> int: return 0 -def find_test_match(test_config: dict, test_playbook_id: str, content_item_id: str, file_type: str) -> bool: +def is_test_config_match(test_config: dict, test_playbook_id: str = '', integration_id: str = '') -> bool: """ Given a test configuration from conf.json file, this method checks if the configuration is configured for the - test playbook with content item. + test playbook or for integration_id. Since in conf.json there could be test configurations with 'integrations' as strings or list of strings the type of test_configurations['integrations'] is checked in first and the match according to the type. If file type is not an integration- will return True if the test_playbook id matches playbookID. Args: - file_type: The file type. can be 'integration', 'script', 'playbook'. test_config: A test configuration from conf.json file under 'tests' key. + file_type: The file type. can be 'integration', 'playbook'. test_playbook_id: A test playbook ID. - content_item_id: A content item ID, could be a script, an integration or a playbook. - + integration_id: An integration ID. + If both test_playbook_id and integration_id are given will look for a match of both, else will look for match + of either test playbook id or integration id Returns: True if the test configuration contains the test playbook and the content item or False if not """ - if test_playbook_id != test_config.get('playbookID'): - return False - if file_type != 'integration': - return True - + test_playbook_match = test_playbook_id == test_config.get('playbookID') test_integrations = test_config.get('integrations') if isinstance(test_integrations, list): - return any( - test_integration for test_integration in test_integrations if test_integration == content_item_id) + integration_match = any( + test_integration for test_integration in test_integrations if test_integration == integration_id) else: - return test_integrations == content_item_id + integration_match = test_integrations == integration_id + # If both playbook id and integration id are given + if integration_id and test_playbook_id: + return test_playbook_match and integration_match + + # If only integration id is given + if integration_id: + return integration_match + + # If only test playbook is given + if test_playbook_id: + return test_playbook_match def get_not_registered_tests(conf_json_tests: list, content_item_id: str, file_type: str, test_playbooks: list) -> list: @@ -842,7 +850,7 @@ def get_not_registered_tests(conf_json_tests: list, content_item_id: str, file_t Args: conf_json_tests: the 'tests' value of 'conf.json file content_item_id: A content item ID, could be a script, an integration or a playbook. - file_type: The file type, could be a script, an integration or a playbook. + file_type: The file type, could be an integration or a playbook. test_playbooks: The yml file's list of test playbooks Returns: @@ -850,12 +858,16 @@ def get_not_registered_tests(conf_json_tests: list, content_item_id: str, file_t """ not_registered_tests = [] for test in test_playbooks: - test_registered_in_conf_json = any( - test_config for test_config in conf_json_tests if find_test_match(test_config, - test, - content_item_id, - file_type) - ) + if file_type == 'playbook': + test_registered_in_conf_json = any( + test_config for test_config in conf_json_tests if is_test_config_match(test_config, + test_playbook_id=test) + ) + else: + test_registered_in_conf_json = any( + test_config for test_config in conf_json_tests if is_test_config_match(test_config, + integration_id=content_item_id) + ) if not test_registered_in_conf_json: not_registered_tests.append(test) return not_registered_tests diff --git a/demisto_sdk/commands/format/update_script.py b/demisto_sdk/commands/format/update_script.py index 134fb97f5f7..3a54cc65afe 100644 --- a/demisto_sdk/commands/format/update_script.py +++ b/demisto_sdk/commands/format/update_script.py @@ -25,7 +25,6 @@ def run_format(self) -> int: try: super().update_yml() self.update_tests() - self.update_conf_json('script') self.save_yml_to_destination_file() return SUCCESS_RETURN_CODE except Exception: diff --git a/demisto_sdk/commands/validate/tests/validators_test.py b/demisto_sdk/commands/validate/tests/validators_test.py index 9f7c5feb93c..e06e8cbb227 100644 --- a/demisto_sdk/commands/validate/tests/validators_test.py +++ b/demisto_sdk/commands/validate/tests/validators_test.py @@ -42,15 +42,16 @@ INVALID_PLAYBOOK_PATH, INVALID_PLAYBOOK_PATH_FROM_ROOT, INVALID_REPUTATION_PATH, INVALID_SCRIPT_PATH, INVALID_WIDGET_PATH, LAYOUT_TARGET, PLAYBOOK_TARGET, REPUTATION_TARGET, - SCRIPT_RELEASE_NOTES_TARGET, SCRIPT_TARGET, VALID_BETA_INTEGRATION, - VALID_BETA_PLAYBOOK_PATH, VALID_DASHBOARD_PATH, VALID_INCIDENT_FIELD_PATH, - VALID_INCIDENT_TYPE_PATH, VALID_INTEGRATION_ID_PATH, - VALID_INTEGRATION_TEST_PATH, VALID_LAYOUT_PATH, VALID_MD, - VALID_MULTI_LINE_CHANGELOG_PATH, VALID_MULTI_LINE_LIST_CHANGELOG_PATH, - VALID_NO_HIDDEN_PARAMS, VALID_ONE_LINE_CHANGELOG_PATH, - VALID_ONE_LINE_LIST_CHANGELOG_PATH, VALID_PACK, VALID_PLAYBOOK_CONDITION, - VALID_REPUTATION_PATH, VALID_SCRIPT_PATH, VALID_TEST_PLAYBOOK_PATH, - VALID_WIDGET_PATH, WIDGET_TARGET) + SCRIPT_RELEASE_NOTES_TARGET, SCRIPT_TARGET, TEST_PLAYBOOK, + VALID_BETA_INTEGRATION, VALID_BETA_PLAYBOOK_PATH, VALID_DASHBOARD_PATH, + VALID_INCIDENT_FIELD_PATH, VALID_INCIDENT_TYPE_PATH, + VALID_INTEGRATION_ID_PATH, VALID_INTEGRATION_TEST_PATH, VALID_LAYOUT_PATH, + VALID_MD, VALID_MULTI_LINE_CHANGELOG_PATH, + VALID_MULTI_LINE_LIST_CHANGELOG_PATH, VALID_NO_HIDDEN_PARAMS, + VALID_ONE_LINE_CHANGELOG_PATH, VALID_ONE_LINE_LIST_CHANGELOG_PATH, + VALID_PACK, VALID_PLAYBOOK_CONDITION, VALID_REPUTATION_PATH, + VALID_SCRIPT_PATH, VALID_TEST_PLAYBOOK_PATH, VALID_WIDGET_PATH, + WIDGET_TARGET) from mock import patch @@ -355,7 +356,8 @@ def test_is_valid_rn(self, mocker, file_path, file_type): mocker.patch.object(DashboardValidator, 'is_id_equals_name', return_value=True) mocker.patch.object(ReputationValidator, 'is_id_equals_details', return_value=True) mocker.patch.object(IntegrationValidator, 'is_valid_beta', return_value=True) - mocker.patch.object(BaseValidator, 'are_tests_configured', return_value=True) + mocker.patch.object(IntegrationValidator, 'are_tests_configured', return_value=True) + mocker.patch.object(PlaybookValidator, 'are_tests_configured', return_value=True) file_validator = FilesValidator(validate_conf_json=False) file_validator.validate_added_files(file_path, file_type) assert file_validator._is_valid @@ -428,13 +430,14 @@ def test_pack_validation(self): assert file_validator._is_valid is False ARE_TEST_CONFIGURED_TEST_INPUT = [ - (VALID_INTEGRATION_TEST_PATH, True), - (INVALID_INTEGRATION_NO_TESTS, False), - (INVALID_INTEGRATION_NON_CONFIGURED_TESTS, False) + (VALID_INTEGRATION_TEST_PATH, 'integration', True), + (INVALID_INTEGRATION_NO_TESTS, 'integration', False), + (INVALID_INTEGRATION_NON_CONFIGURED_TESTS, 'integration', True), + (TEST_PLAYBOOK, 'playbook', False) ] - @pytest.mark.parametrize('file_path, expected', ARE_TEST_CONFIGURED_TEST_INPUT) - def test_are_tests_configured(self, file_path, expected): + @pytest.mark.parametrize('file_path, file_type, expected', ARE_TEST_CONFIGURED_TEST_INPUT) + def test_are_tests_configured(self, file_path, file_type, expected): # type: (str, bool) -> None """ Given @@ -446,6 +449,6 @@ def test_are_tests_configured(self, file_path, expected): Then - validator return the correct answer accordingly """ - structure_validator = StructureValidator(file_path, predefined_scheme='integration') - validator = BaseValidator(structure_validator) + structure_validator = StructureValidator(file_path, predefined_scheme=file_type) + validator = IntegrationValidator(structure_validator) assert validator.are_tests_configured() == expected diff --git a/demisto_sdk/tests/constants_test.py b/demisto_sdk/tests/constants_test.py index f60ff7716c5..4a842665470 100644 --- a/demisto_sdk/tests/constants_test.py +++ b/demisto_sdk/tests/constants_test.py @@ -9,6 +9,7 @@ INVALID_INTEGRATION_NO_TESTS = f'{GIT_ROOT}/demisto_sdk/tests/test_files/non-valid-integration-no-test-playbooks.yml' INVALID_INTEGRATION_NON_CONFIGURED_TESTS = f'{GIT_ROOT}/demisto_sdk/tests/test_files/' \ f'non-valid-integration-test-not-configured.yml' +TEST_PLAYBOOK = f'{GIT_ROOT}/demisto_sdk/tests/test_files/playbook-TestPlaybooks.yml' VALID_INTEGRATION_TEST_PATH = f"{GIT_ROOT}/demisto_sdk/tests/test_files/integration-test.yml" INVALID_INTEGRATION_WITH_NO_TEST_PLAYBOOK = 'demisto_sdk/tests/test_files/integration-test-with-no-test-playbook.yml' VALID_INTEGRATION_ID_PATH = f"{GIT_ROOT}/demisto_sdk/tests/test_files/integration-valid-id-test.yml" diff --git a/demisto_sdk/tests/integration_tests/format_integration_test.py b/demisto_sdk/tests/integration_tests/format_integration_test.py index 135d1561439..ddd1c600650 100644 --- a/demisto_sdk/tests/integration_tests/format_integration_test.py +++ b/demisto_sdk/tests/integration_tests/format_integration_test.py @@ -6,23 +6,19 @@ import pytest from click.testing import CliRunner from demisto_sdk.__main__ import main -from demisto_sdk.commands.common.tools import (find_test_match, - get_dict_from_file) +from demisto_sdk.commands.common.tools import (get_dict_from_file, + is_test_config_match) from demisto_sdk.commands.format.update_generic_yml import BaseUpdateYML from demisto_sdk.commands.format.update_integration import IntegrationYMLFormat from demisto_sdk.commands.format.update_playbook import PlaybookYMLFormat -from demisto_sdk.commands.format.update_script import ScriptYMLFormat from demisto_sdk.tests.constants_test import ( DESTINATION_FORMAT_INTEGRATION_COPY, DESTINATION_FORMAT_PLAYBOOK_COPY, - DESTINATION_FORMAT_SCRIPT_COPY, INTEGRATION_WITH_TEST_PLAYBOOKS, - PLAYBOOK_WITH_TEST_PLAYBOOKS, SCRIPT_WITH_TEST_PLAYBOOKS, - SOURCE_FORMAT_INTEGRATION_COPY, SOURCE_FORMAT_PLAYBOOK_COPY, - SOURCE_FORMAT_SCRIPT_COPY) + INTEGRATION_WITH_TEST_PLAYBOOKS, PLAYBOOK_WITH_TEST_PLAYBOOKS, + SOURCE_FORMAT_INTEGRATION_COPY, SOURCE_FORMAT_PLAYBOOK_COPY) BASIC_YML_TEST_PACKS = [ (SOURCE_FORMAT_INTEGRATION_COPY, DESTINATION_FORMAT_INTEGRATION_COPY, IntegrationYMLFormat, 'New Integration_copy', 'integration'), - (SOURCE_FORMAT_SCRIPT_COPY, DESTINATION_FORMAT_SCRIPT_COPY, ScriptYMLFormat, 'New_script_copy', 'script'), (SOURCE_FORMAT_PLAYBOOK_COPY, DESTINATION_FORMAT_PLAYBOOK_COPY, PlaybookYMLFormat, 'File Enrichment-GenericV2_copy', 'playbook') ] @@ -34,12 +30,6 @@ IntegrationYMLFormat, 'New Integration', 'integration'), - ( - SCRIPT_WITH_TEST_PLAYBOOKS, - DESTINATION_FORMAT_SCRIPT_COPY, - ScriptYMLFormat, - 'New_script_copy', - 'script'), ( PLAYBOOK_WITH_TEST_PLAYBOOKS, DESTINATION_FORMAT_PLAYBOOK_COPY, @@ -170,7 +160,10 @@ def test_integration_format_configuring_conf_json_positive(tmp_path: PosixPath, prompt = 'The following test playbooks are not configured in conf.json file' assert not result.exception assert prompt in result.output - _verify_conf_json_modified(file_type, test_playbooks, yml_title, conf_json_path) + if file_type == 'playbook': + _verify_conf_json_modified(test_playbooks, '', conf_json_path) + else: + _verify_conf_json_modified(test_playbooks, yml_title, conf_json_path) # Running format for the second time should raise no exception and should raise no prompt to the user result = runner.invoke(main, [FORMAT_CMD, '-i', saved_file_path], input='Y') assert not result.exception @@ -216,7 +209,7 @@ def test_integration_format_configuring_conf_json_negative(tmp_path: PosixPath, assert 'Skipping test playbooks configuration' in result.output -def _verify_conf_json_modified(file_type: str, test_playbooks: List, yml_title: str, conf_json_path: str): +def _verify_conf_json_modified(test_playbooks: List, yml_title: str, conf_json_path: str): """ Verifying all test playbooks are configured in conf.json file """ @@ -225,10 +218,11 @@ def _verify_conf_json_modified(file_type: str, test_playbooks: List, yml_title: conf_json_content = json.load(data_file) for test_playbook in test_playbooks: assert any( - test_config for test_config in conf_json_content['tests'] if find_test_match(test_config, - test_playbook, - yml_title, - file_type) + test_config for test_config in conf_json_content['tests'] if + is_test_config_match(test_config, + test_playbook_id=test_playbook, + integration_id=yml_title, + ) ) except Exception: raise diff --git a/demisto_sdk/tests/test_files/format_script_with_test_playbooks.yml b/demisto_sdk/tests/test_files/format_script_with_test_playbooks.yml deleted file mode 100644 index 399b0166313..00000000000 --- a/demisto_sdk/tests/test_files/format_script_with_test_playbooks.yml +++ /dev/null @@ -1,56 +0,0 @@ -commonfields: - id: 8908983a-dcaf-40c0-8c8c-d2c61b1e826b - version: 2 -name: New_script_copy -script: | - # Python template - reading arguments, calling a command, handling errors and returning results - res = [] - # Constant and mandatory arguments - dArgs = {"myargname": "myvalue", - "myotherarg": demisto.args()["mandatoryscriptarg"]} - # Optional arguments - if "myoptionalscriptarg" in demisto.args(): - dArgs["myinternalarg"] = demisto.args()["myoptionalscriptarg"] - # Optional arguments with defaults - sometimes the arg is mandatory for our executeCommand - dArgs["myargwithdefault"] = demisto.args()["myotherscriptarg"] if "myotherscriptarg" in demisto.args() else "10" - - # Calling a command - returns a list of one or more entries - resCmdName = demisto.executeCommand("dummy-command", dArgs) - try: - for entry in resCmdName: - if isError(entry): - # Check if it's that error we know about and have a solution for - notify, retry, display a specific error message, etc. - if "failed with status 404 NOT FOUND" in entry["Contents"]: - res.append({"Type": entryTypes["error"], "ContentsFormat": formats["text"], - "Contents": "Received HTTP Error 404 from Session API. Please ensure that you do not already have an active session with that sensor."}) - else: - # If it's not an error we recognize - send all entries returned from the command back to the war room as-is. - res = resCmdName - break - # # If it's not an error we recognize - send that error to the war room but keep handling the other returned entries - # res.append(entry) - else: - myData = demisto.get(entry, 'Contents.result_obj.results') - # Log myData to war room - for debugging. May remove this later in production script - demisto.log(str(myData)) - if myData: - res.append({"Type": entryTypes["note"], "ContentsFormat": formats["table"], "Contents": myData}) - else: - res.append({"Type": entryTypes["error"], "ContentsFormat": formats["text"], - "Contents": "Could not extract result list from response: " + json.dumps(entry["Contents"])}) - except Exception as ex: - res.append({"Type": entryTypes["error"], "ContentsFormat": formats["text"], - "Contents": "Error occurred while parsing output from command. Exception info:\n" + str(ex) + "\n\nInvalid output:\n" + str(resCmdName)}) - demisto.results(res) -type: python -tags: -- Algosec -enabled: true -scripttarget: 0 -subtype: python3 -runonce: false -dockerimage: demisto/python3:3.7.3.286 -runas: DBotWeakRole -tests: - - test1 - - test2 diff --git a/demisto_sdk/tests/test_files/non-valid-integration-no-test-playbooks.yml b/demisto_sdk/tests/test_files/non-valid-integration-no-test-playbooks.yml index 3f8da44c7b3..540b8630062 100644 --- a/demisto_sdk/tests/test_files/non-valid-integration-no-test-playbooks.yml +++ b/demisto_sdk/tests/test_files/non-valid-integration-no-test-playbooks.yml @@ -1,8 +1,8 @@ commonfields: - id: PagerDuty v2 + id: PagerDuty v25 version: 123 -name: PagerDuty v2 -display: PagerDuty v2 +name: PagerDuty v25 +display: PagerDuty v25 category: Messaging image: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAmCAYAAAAP4F9VAAAPuklEQVR4AezQsQAAAAACsPKXjqF/Q1g4AQBAFaxdqwBvKtvWx+LaNk3dvbiMFB4uY7hed3d3d3e/4+7uLkhhilwcakPd4p5j719tAmkmzIf06c067K/Jztal/1qH86OeYI/uxhP//NFAaKCo2FQ8+L6GD3wL3THmfzkJbwS6z2NYlmRV5kJSaEZA9JeFJJuDvk/V2kEpyPYGe/mwGOagPDJtN2UC7gv1ncewLDkNTm4oPDitN9RbKnCCNa7Ep0zA7d5Tl7WOtH7PFR3Tz3XMe3GuY/5P0K1MiYBZ5nzOmSUDb1A1nCai5bQM/oY5hlOnau2RyHDhKd+Ja4ZCQ4xD5wjU2xqmbG0hKAbOY1iW+kK9UUCWpFWxEPKUra3jdWEoUETLaw1GwRjYNbRj6gSMxZgk1dhqjXpB36zIijHFRbAqo8Tt+tzj+OxPndxgbSjeObyjTsNq5MnIjWVlRpFFJd6Jr8NMBioyFnGuiGs6y7L2tL3Cufq8o/gczTRvMDSg9YuB0rHoKM+zPEOkqApbaakK4uNApjmIa9xIZGQGzmlL7qXiEVVJmJM3t4swVHLscHTItmd4t1OURQZnY+iJyTHFIBh0iLs66qPpPMfLQ6HB6hO+k5UG3hgtMhacQL+bSSOO5W0DocHmmBI1GHnjaXR19gRPV7ljLoHOj9XiZo25RFYklbyDL+6zFpmKaiNiRMVenKiI7JXOBWMOfa5v18iuMuxpaMqZFpiWO30gkxt3R901aKUcy6q4Y0BotDcxi4uXcne23/7JJ3ue+JisSoWqqgjE6xSkLUPLxloKFvy1OWf678b5AwJAW3t35x2/wAXVNwNylQ4YrLPVP7SxcvMP0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4U/MaBDwoyZLOorXsZ/4bCKjz9TJThV1geTkNiNBLcPr9FL7c9dcjf05TuCw5jYXHS00lTwGfiJPLuCrHs1yk0FD4L6D72075TinUz+J/XDD/fylL3AWOz1JWwFnKCjhLWQFnKSvgLGUFnKX/BJsiJ1QqG3uJAAAAAElFTkSuQmCC description: Alert and notify users using PagerDuty diff --git a/demisto_sdk/tests/test_files/non-valid-integration-test-not-configured.yml b/demisto_sdk/tests/test_files/non-valid-integration-test-not-configured.yml index 36c660ea75c..7a54b9342a6 100644 --- a/demisto_sdk/tests/test_files/non-valid-integration-test-not-configured.yml +++ b/demisto_sdk/tests/test_files/non-valid-integration-test-not-configured.yml @@ -1,8 +1,8 @@ commonfields: - id: PagerDuty v2 + id: PagerDuty v3 version: 123 -name: PagerDuty v2 -display: PagerDuty v2 +name: PagerDuty v3 +display: PagerDuty v3 category: Messaging image: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAmCAYAAAAP4F9VAAAPuklEQVR4AezQsQAAAAACsPKXjqF/Q1g4AQBAFaxdqwBvKtvWx+LaNk3dvbiMFB4uY7hed3d3d3e/4+7uLkhhilwcakPd4p5j719tAmkmzIf06c067K/Jztal/1qH86OeYI/uxhP//NFAaKCo2FQ8+L6GD3wL3THmfzkJbwS6z2NYlmRV5kJSaEZA9JeFJJuDvk/V2kEpyPYGe/mwGOagPDJtN2UC7gv1ncewLDkNTm4oPDitN9RbKnCCNa7Ep0zA7d5Tl7WOtH7PFR3Tz3XMe3GuY/5P0K1MiYBZ5nzOmSUDb1A1nCai5bQM/oY5hlOnau2RyHDhKd+Ja4ZCQ4xD5wjU2xqmbG0hKAbOY1iW+kK9UUCWpFWxEPKUra3jdWEoUETLaw1GwRjYNbRj6gSMxZgk1dhqjXpB36zIijHFRbAqo8Tt+tzj+OxPndxgbSjeObyjTsNq5MnIjWVlRpFFJd6Jr8NMBioyFnGuiGs6y7L2tL3Cufq8o/gczTRvMDSg9YuB0rHoKM+zPEOkqApbaak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At6H7s/GZnCfX9+yHgzQInkPc4JqTGGCBcgflvILyg+NiBkX0beW5ySgJwJqN2bQLavgIuCYe1et5e9652JkupHvM9JzzH367jtHISPyXSOwUvLcyHPYdaqKRcbCjpxMudVwVYrwaNRyMh/7cIGLF4wUuDL67Wcpo3lfNYPNRPoHNF8crrV5asSnGJWfpu27fmPXH68atRWCLhTuYeAcFE1ROY5fez8mY9LcCHxwEQorzMC6gSScx/A+GFwQje4nhQekyHgSxIRf9oman8ri01W39Cb1WYLKXwLidQYiqNGwWDnCrgCbjAioQVkOlcv7R42Z/Rqwh4U/MaBDwoyZLOorXsZ/4bCKjz9TJThV1geTkNiNBLcPr9FL7c9dcjf05TuCw5jYXHS00lTwGfiJPLuCrHs1yk0FD4L6D72075TinUz+J/XDD/fylL3AWOz1JWwFnKCjhLWQFnKSvgLGUFnKX/BJsiJ1QqG3uJAAAAAElFTkSuQmCC description: Alert and notify users using PagerDuty diff --git a/demisto_sdk/tests/test_files/playbook-TestPlaybooks.yml b/demisto_sdk/tests/test_files/playbook-TestPlaybooks.yml new file mode 100644 index 00000000000..936cb49b106 --- /dev/null +++ b/demisto_sdk/tests/test_files/playbook-TestPlaybooks.yml @@ -0,0 +1,205 @@ +id: Test playbook +version: 11 +name: Test playbook +starttaskid: "0" +tasks: + "0": + id: "0" + taskid: df426ee9-d162-4855-8c5b-0fe6f415d31d + type: start + task: + id: df426ee9-d162-4855-8c5b-0fe6f415d31d + version: -1 + name: "" + iscommand: false + brand: "" + nexttasks: + '#none#': + - "1" + separatecontext: false + view: |- + { + "position": { + "x": 50, + "y": 50 + } + } + note: false + timertriggers: [] + ignoreworker: false + "1": + id: "1" + taskid: ad563d96-52f2-45a6-8bfc-1e509f96bc7d + type: regular + task: + id: ad563d96-52f2-45a6-8bfc-1e509f96bc7d + version: -1 + name: Gmail search + description: Searches for Gmail records of a specified Google user. + script: Gmail|||gmail-search + type: regular + iscommand: true + brand: Gmail + nexttasks: + '#none#': + - "2" + scriptarguments: + after: {} + before: {} + fields: {} + filename: {} + from: {} + has-attachments: {} + in: {} + include-spam-trash: {} + labels-ids: {} + max-results: {} + page-token: {} + query: {} + subject: {} + to: {} + user-id: + simple: koko@demisto.com + separatecontext: false + view: |- + { + "position": { + "x": 50, + "y": 195 + } + } + note: false + timertriggers: [] + ignoreworker: false + "2": + id: "2" + taskid: b1ba6ee2-a80a-4fb3-8ba3-d689d599444c + type: regular + task: + id: b1ba6ee2-a80a-4fb3-8ba3-d689d599444c + version: -1 + name: Read file + description: Load the contents of a file into context. + scriptName: ReadFile + type: regular + iscommand: false + brand: "" + nexttasks: + '#none#': + - "4" + scriptarguments: + encoding: {} + entryID: + simple: entryId + maxFileSize: {} + separatecontext: false + view: |- + { + "position": { + "x": 50, + "y": 370 + } + } + note: false + timertriggers: [] + ignoreworker: false + "3": + id: "3" + taskid: c496302f-4d40-4412-86a8-da1c355b039b + type: title + task: + id: c496302f-4d40-4412-86a8-da1c355b039b + version: -1 + name: Done + type: title + iscommand: false + brand: "" + separatecontext: false + view: |- + { + "position": { + "x": 50, + "y": 720 + } + } + note: false + timertriggers: [] + ignoreworker: false + "4": + id: "4" + taskid: 38c6ac55-ffd2-47cc-81ab-cd80d63efe9c + type: playbook + task: + id: 38c6ac55-ffd2-47cc-81ab-cd80d63efe9c + version: -1 + name: Get Original Email - Gmail + playbookName: Get Original Email - Gmail + type: playbook + iscommand: false + brand: "" + nexttasks: + '#none#': + - "3" + separatecontext: true + view: |- + { + "position": { + "x": 50, + "y": 545 + } + } + note: false + timertriggers: [] + ignoreworker: false +view: |- + { + "linkLabelsPosition": {}, + "paper": { + "dimensions": { + "height": 735, + "width": 380, + "x": 50, + "y": 50 + } + } + } +inputs: +- key: InputA + value: + complex: + root: File + accessor: Name + required: false + description: "" +- key: InputB + value: + simple: johnnydepp@gmail.com + required: true + description: This is input b +- key: "" + value: {} + required: false + description: "" + playbookInputQuery: + query: (type:ip or type:file or type:Domain or type:URL) -tags:pending_review + and (tags:approved_black or tags:approved_white or tags:approved_watchlist) + queryEntity: indicators + results: null + daterange: + fromdate: 0001-01-01T00:00:00Z + todate: 0001-01-01T00:00:00Z + period: + by: "" + byto: "" + byfrom: "" + tovalue: null + fromvalue: null + field: "" + fromdatelicenseval: 0001-01-01T00:00:00Z + runFromLastJobTime: false +outputs: +- contextPath: Email.To + description: The recipient of the email. + type: string +- contextPath: FileData + type: string