示例#1
0
def test_with_scenarios(mocker, folder, expected):
    ansible = Ansible(base=folder)
    ansible.options = mocker.Mock()
    ansible.options.ignore_paths = []
    # ansible._scenarios = scenarios  # pylint: disable=protected-access
    assert ansible.directory == os.path.realpath(folder)
    assert ansible.is_ansible == expected
示例#2
0
def test_scenarios_with_base_molecule_config(mocker):
    ansible = Ansible("tests/fixtures/collection")
    base_configs = [os.path.join(ansible.directory, "molecule.yml")]
    ansible.options = mocker.Mock()
    ansible.options.ignore_paths = []
    ansible.options.molecule_config_files = base_configs
    assert ansible.molecule_config_files() == base_configs
示例#3
0
def test_with_scenarios(mocker, folder):
    ansible = Ansible(base=folder)
    ansible.options = mocker.Mock()
    ansible.options.ignore_paths = []
    ansible.options.molecule_config_files = []
    # ansible._scenarios = scenarios  # pylint: disable=protected-access
    assert ansible.directory == os.path.realpath(folder)
示例#4
0
def test_scenarios_correct(mocker):
    ansible = Ansible("tests/fixtures/collection")
    ansible.options = mocker.Mock()
    ansible.options.ignore_paths = []
    ansible.options.molecule_config_files = []
    assert len(ansible.scenarios) == 6
    # Second call to be sure we are not walking twice
    assert len(ansible.scenarios) == 6
示例#5
0
def test_scenarios_with_global_molecule_config(mocker):
    ansible = Ansible("tests/fixtures/not_collection")
    global_config = [
        os.path.join(ansible.directory, ".config/molecule/config.yml")
    ]
    ansible.options = mocker.Mock()
    ansible.options.ignore_paths = []
    ansible.options.molecule_config_files = []
    assert ansible.molecule_config_files() == global_config
示例#6
0
def test_ignore_paths(mocker):
    ansible = Ansible("tests/fixtures/collection")
    ansible.options = mocker.Mock()
    # We're ignoring one of them
    ansible.options.ignore_paths = ["one"]
    ansible.options.molecule_config_files = [
        "tests/fixtures/collection/molecule.yml"
    ]
    assert len(ansible.scenarios) == 5
    assert len(ansible.molecule_config) == 1
示例#7
0
def test_scenarios_correct(mocker):
    ansible = Ansible("tests/fixtures/collection")
    ansible.options = mocker.Mock()
    ansible.options.ignore_paths = []
    assert len(ansible.scenarios) == 6