How to use the molecule.model.schema_v2.validate function in molecule

To help you get started, we’ve selected a few molecule examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ansible / molecule / test / unit / model / v2 / test_platforms_section.py View on Github external
def test_platforms_driver_name_required(_config):
    del _config['platforms'][0]['name']
    x = {'platforms': [{0: [{'name': ['required field']}]}]}

    assert x == schema_v2.validate(_config)
github ansible / molecule / test / unit / model / v2 / test_verifier_section.py View on Github external
def test_verifier_errors_readonly_options_section_data(_config):
    x = {'verifier': [{'options': [{'foo': ['field is read-only']}]}]}

    assert x == schema_v2.validate(_config)
github ansible / molecule / test / unit / model / v2 / test_platforms_section.py View on Github external
def test_platforms_linode_fields_required(_config, _required_field):
    del _config['platforms'][0][_required_field]
    expected_config = {'platforms': [{0: [{_required_field: ['required field']}]}]}
    assert expected_config == schema_v2.validate(_config)
github ansible / molecule / test / unit / cookiecutter / test_molecule.py View on Github external
def test_verifier_lint_when_verifier_inspec(
    temp_dir, _molecule_file, _role_directory, _command_args, _instance
):
    _command_args['verifier_name'] = 'inspec'
    _command_args['verifier_lint_name'] = 'rubocop'
    _instance._process_templates('molecule', _command_args, _role_directory)

    data = util.safe_load_file(_molecule_file)

    assert {} == schema_v2.validate(data)

    cmd = sh.yamllint.bake('-s', _molecule_file)
    pytest.helpers.run_command(cmd)
github ansible / molecule / test / unit / model / v2 / test_scenario_section.py View on Github external
def test_scenario_has_errors(_config):
    x = {
        'scenario': [
            {
                'converge_sequence': [{0: ['must be of string type']}],
                'name': ['must be of string type'],
                'check_sequence': [{0: ['must be of string type']}],
                'create_sequence': [{0: ['must be of string type']}],
                'destroy_sequence': [{0: ['must be of string type']}],
                'test_sequence': [{0: ['must be of string type']}],
            }
        ]
    }

    assert x == schema_v2.validate(_config)
github ansible / molecule / test / unit / model / v2 / test_driver_section.py View on Github external
def test_driver_invalid_provider_name_has_errors(_config):
    x = {'driver': [{'provider': [{'name': ['unallowed value ']}]}]}

    assert x == schema_v2.validate(_config)
github ansible / molecule / test / unit / model / v2 / test_scenario_section.py View on Github external
def test_scenario(_config):
    assert {} == schema_v2.validate(_config)
github ansible / molecule / test / unit / model / v2 / test_driver_section.py View on Github external
def test_driver_provider_name_not_nullable_when_vagrant_driver(_config):
    x = {'driver': [{'provider': [{'name': ['null value not allowed']}]}]}

    assert x == schema_v2.validate(_config)
github ansible / molecule / test / unit / model / v2 / test_dependency_section.py View on Github external
def test_dependency_allows_shell_name(_config):
    assert {} == schema_v2.validate(_config)