Fix tests for code

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-11-06 16:58:30 +01:00
parent 4a67d768d5
commit 04bd5d88c3
2 changed files with 11 additions and 7 deletions

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# 2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2011 Steven Armstrong (steven-cdist at armstrong.cc)
# 2011 Nico Schottelius (nico-cdist at schottelius.org) # 2011-2012 Nico Schottelius (nico-cdist at schottelius.org)
# #
# This file is part of cdist. # This file is part of cdist.
# #

View file

@ -34,23 +34,27 @@ from cdist.core import code
import os.path as op import os.path as op
my_dir = op.abspath(op.dirname(__file__)) my_dir = op.abspath(op.dirname(__file__))
fixtures = op.join(my_dir, 'fixtures') fixtures = op.join(my_dir, 'fixtures')
local_base_path = fixtures conf_dir = op.join(fixtures, 'conf')
class CodeTestCase(test.CdistTestCase): class CodeTestCase(test.CdistTestCase):
def setUp(self): def setUp(self):
self.target_host = 'localhost' self.target_host = 'localhost'
self.local_base_path = local_base_path
self.out_path = self.mkdtemp() self.out_path = self.mkdtemp()
self.local = local.Local(self.target_host, self.local_base_path, self.out_path)
self.local = local.Local(
target_host=self.target_host,
out_path = self.out_path,
exec_path = cdist.test.cdist_exec_path,
add_conf_dirs=[conf_dir])
self.local.create_files_dirs() self.local.create_files_dirs()
self.remote_base_path = self.mkdtemp() self.remote_base_path = self.mkdtemp()
self.user = getpass.getuser() remote_exec = self.remote_exec
remote_exec = "ssh -o User=%s -q" % self.user remote_copy = self.remote_copy
remote_copy = "scp -o User=%s -q" % self.user
self.remote = remote.Remote(self.target_host, self.remote_base_path, remote_exec, remote_copy) self.remote = remote.Remote(self.target_host, self.remote_base_path, remote_exec, remote_copy)
self.remote.create_files_dirs()
self.code = code.Code(self.target_host, self.local, self.remote) self.code = code.Code(self.target_host, self.local, self.remote)