def test_can_set_binary_path(self, mock_run, mock_copy_dir):
class DummyGuest(Guest):
name = 'dummy'
host = Host()
guest = DummyGuest(unittest.mock.Mock())
mock_run.return_value = 0
provisioner = PuppetProvisioner('./', host, [guest], {
'manifest_file': 'test_site.pp',
'manifests_path': 'test_manifests',
'binary_path': '/test/path'})
provisioner.provision()
assert mock_run.call_count == 2
assert mock_run.call_args_list[0][0][0] == ['test', '-x', '/test/path/puppet']
assert mock_run.call_args_list[1][0][0] == [
'sh', '-c',
'/test/path/puppet apply --detailed-exitcodes --manifestdir {} {}'.format(
PurePosixPath(provisioner._guest_manifests_path),
PurePosixPath(provisioner._guest_manifests_path) / 'test_site.pp')]
评论列表
文章目录