Ejemplo n.º 1
0
    def test_isarray_false(self, integration, capsys):
        """
        Given:
        - An integration with IP command and ip argument when isArray is False

        When:
        - Running validate on IP command

        Then:
        - Check a warning printed to the user.
        - Validate isArray hasn't changed.

        """
        yml_contents = integration.yml.read_dict()
        yml_contents['script']['commands'] = [
            {
                'name': 'ip',
                'arguments': [{
                    'isArray': False,
                    'name': 'ip'
                }]
            }
        ]
        integration.yml.write_dict(yml_contents)
        base_yml = IntegrationYMLFormat(integration.yml.path)
        base_yml.set_reputation_commands_basic_argument_as_needed()
        captured = capsys.readouterr()
        assert 'Array field in ip command is set to False.' in captured.out
        assert integration.yml.read_dict()['script']['commands'][0]['arguments'][0]['isArray'] is False
Ejemplo n.º 2
0
def test_bang_commands_default_arguments(source_path, bang_command, verifications):
    base_yml = IntegrationYMLFormat(source_path)
    base_yml.set_reputation_commands_basic_argument_as_needed()

    for command in base_yml.yml_data['script']['commands']:
        if bang_command == command['name']:
            command_arguments = command['arguments']
            for argument in command_arguments:
                if argument.get('name', '') == bang_command:
                    for verification in verifications:
                        assert argument[verification[0]] == verification[1]
Ejemplo n.º 3
0
def test_bang_commands_default_arguments(source_path, file_type, bang_command, verifications):
    schema_path = os.path.normpath(
        os.path.join(__file__, "..", "..", "..", "common", "schemas", '{}.yml'.format(file_type)))
    base_yml = IntegrationYMLFormat(source_path, path=schema_path)
    base_yml.set_reputation_commands_basic_argument_as_needed()

    for command in base_yml.data['script']['commands']:
        if bang_command == command['name']:
            command_arguments = command['arguments']
            for argument in command_arguments:
                if argument.get('name', '') == bang_command:
                    for verification in verifications:
                        assert argument[verification[0]] == verification[1]