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)
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')
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}')
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)
def test_defaults(): provision = Provision({}, PlanMock()) provision.wake() for provision_data in provision.data: assert provision_data['how'] == 'virtual'
def test_empty_plan(): provision = Provision({}, None) with pytest.raises(GeneralError): provision.wake()