예제 #1
0
def test_case_is_simple_with_config_files(config, opts, scenario, mocker):
    base_configs = [
        "/home/jdoe/my_ansible_collections/tests/molecule_one.yml",
        "/home/jdoe/my_ansible_collections/tests/molecule_one.yml",
    ]
    mocker.patch.object(
        Options, "global_opts", new_callable=mocker.PropertyMock, return_value=[]
    )
    mocker.patch.object(
        Tox, "posargs", new_callable=mocker.PropertyMock, return_value=[]
    )
    t = ToxMoleculeCase(scenario)
    opts.molecule_config_files = base_configs
    assert t.get_name() == "my_test"
    assert t.working_dir == ""
    cmds = [
        [
            "molecule",
            "-c",
            base_configs[0],
            "-c",
            base_configs[-1],
            "test",
            "-s",
            scenario.name,
        ]
    ]
    assert t.get_commands(opts) == cmds
    assert t.basepython is None
def test_case_is_simple(config, opts, scenario, mocker):
    mocker.patch.object(Options, "get_global_opts", return_value=[])
    mocker.patch.object(Tox,
                        "posargs",
                        new_callable=mocker.PropertyMock,
                        return_value=[])
    t = ToxMoleculeCase(scenario)
    assert t.get_name() == "my_test"
    assert t.get_working_dir() == ""
    assert sorted(t.get_dependencies()) == sorted(BASE_DEPS + ["ansible"])
    cmds = [["molecule", "test", "-s", scenario.name]]
    assert t.get_commands(opts) == cmds
    assert t.get_basepython() is None
예제 #3
0
def test_case_is_simple(config, opts, scenario, mocker):
    mocker.patch.object(
        Options, "global_opts", new_callable=mocker.PropertyMock, return_value=[]
    )
    mocker.patch.object(
        Tox, "posargs", new_callable=mocker.PropertyMock, return_value=[]
    )
    t = ToxMoleculeCase(scenario)
    opts.molecule_config_files = []
    assert t.get_name() == "my_test"
    assert t.working_dir == ""
    cmds = [["molecule", "test", "-s", scenario.name]]
    assert t.get_commands(opts) == cmds
    assert t.basepython is None
예제 #4
0
def test_odd_name(odd_scenario):
    t = ToxMoleculeCase(odd_scenario, drivers=[])
    assert t.get_name() == "somedir-scenario"
예제 #5
0
def test_long_name(long_scenario):
    t = ToxMoleculeCase(long_scenario, drivers=["empty"])
    assert t.get_name() == "roles-somedir-subdir-foo"