def test_build_args_dict_date_args(self): """ Given: - Cortex XSOAR arguments. - Command arg names. When: - Parsing date parameters. Then: - Ensure date parameters values are updated accordingly. """ args = { 'published_before': '1640508554', 'launched_after_datetime': '2021-12-26T08:49:29Z', 'start_date': '2021-12-26T08:49:29Z' } expected_result = { 'launched_after_datetime': '2021-12-26', 'published_before': '2021-12-26', 'start_date': '12/26/2021' } build_args_dict(args, { 'args': ['published_before', 'launched_after_datetime', 'start_date'] }, False) assert Qualysv2.args_values == expected_result
def test_build_args_dict_default_added_depended_args(self): """ Given: - Cortex XSOAR arguments. - Command arg names. When: - There are arguments who should be added depending on an arguments. Then: - Ensure arguments are added as expected. """ args = {'arg_to_depend_on': '1'} expected_result = {'arg_to_depend_on': '1', 'dep1': 2, 'dep2': 3} build_args_dict( args, { 'args': ['arg_to_depend_on'], 'default_added_depended_args': { 'arg_to_depend_on': { 'dep1': 2, 'dep2': 3 } } }, False) assert Qualysv2.args_values == expected_result
def test_build_args_dict_none_args(self): """ Given - arguments received by the user - command name to be run When - No arguments were provided Then - create a dictionary with no arguments' values """ args = None command_args_data = COMMANDS_ARGS_DATA['test-module'] build_args_dict(args, command_args_data, False) assert Qualysv2.args_values == {}
def test_build_inner_args_dict_all_args(self): """ Given - arguments received by the user - command name to be run When - all arguments where provided and there are both API args and inner-use args Then - create a dictionary with all the arguments """ args = {'id': 'id', 'file_format': 'xml'} command_args_data = COMMANDS_ARGS_DATA['qualys-report-fetch'] build_args_dict(args, command_args_data, True) assert Qualysv2.inner_args_values == {'file_format': 'xml'}
def test_build_api_args_dict_empty_date(self): """ Given - arguments received by the user - command name to be run When - Some arguments were not provided and there are only API args Then - create a dictionary with the provided arguments values and None value for arguments that were not provided """ args = {'published_before': ''} command_args_data = COMMANDS_ARGS_DATA['qualys-vulnerability-list'] build_args_dict(args, command_args_data, False) assert Qualysv2.args_values == {}
def test_build_api_args_dict_missing_args(self): """ Given - arguments received by the user - command name to be run When - Some arguments were not provided and there are only API args Then - create a dictionary with the provided arguments values and None value for arguments that were not provided """ args = {'ips': 'ip'} command_args_data = COMMANDS_ARGS_DATA['qualys-ip-list'] build_args_dict(args, command_args_data, False) assert Qualysv2.args_values == args
def test_build_api_args_dict_all_args(self): """ Given - arguments received by the user - command name to be run When - all arguments where provided and there are only API args Then - create a dictionary with all the arguments """ args = {'ips': 'ip', 'network_id': 'id', 'tracking_method': 'method', 'compliance_enabled': True} command_args_data = COMMANDS_ARGS_DATA['qualys-ip-list'] build_args_dict(args, command_args_data, False) assert Qualysv2.args_values == args