Exemple #1
0
def test_localhost_prepare_shell():
    plan = PlanMock()
    provision = Provision({'how': 'localhost'}, plan)
    provision.wake()

    with patch('tmt.utils.Common.run') as run:
        provision.prepare('shell', 'a b c')
        run.assert_called_once_with('a b c', cwd=plan.run.tree.root)
Exemple #2
0
def test_localhost_execute():
    plan = PlanMock()
    provision = Provision({'how': 'localhost'}, plan)
    provision.wake()

    with patch('tmt.utils.Common.run') as run:
        provision.execute('a', 'b', 'c')
        run.assert_called_once_with('a b c')
Exemple #3
0
def test_localhost_prepare_ansible():
    plan = PlanMock()
    provision = Provision({'how': 'localhost'}, plan)
    provision.wake()

    with patch('tmt.utils.Common.run') as run:
        provision.prepare('ansible', 'playbook.yml')
        playbook = os.path.join(plan.run.tree.root, 'playbook.yml')
        run.assert_called_once_with(
            f'ansible-playbook -vb -c local -i localhost, {playbook}')
Exemple #4
0
def test_pick_provision(how, provisioner):
    plan = PlanMock()
    provision = Provision({'how': how}, plan)
    provision.wake()
    for guest in provision.guests():
        assert isinstance(guest, tmt.base.Guest)
Exemple #5
0
def test_defaults():
    provision = Provision({}, PlanMock())
    provision.wake()
    for provision_data in provision.data:
        assert provision_data['how'] == 'virtual'
Exemple #6
0
def test_empty_plan():
    provision = Provision({}, None)
    with pytest.raises(GeneralError):
        provision.wake()