update a lot of tests for new exec.local

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-11-01 15:20:10 +01:00
commit 528901bdee
7 changed files with 57 additions and 15 deletions

View file

@ -33,6 +33,7 @@ from cdist.exec import local
import os.path as op
my_dir = op.abspath(op.dirname(__file__))
fixtures = op.join(my_dir, 'fixtures')
conf_dir = op.join(fixtures, "conf")
class LocalTestCase(test.CdistTestCase):
@ -86,6 +87,41 @@ class LocalTestCase(test.CdistTestCase):
def test_type_path(self):
self.assertEqual(self.local.type_path, os.path.join(self.out_path, "conf", "type"))
def test_dist_conf_dir_linking(self):
"""Ensure that links are correctly created for types included in distribution"""
test_type="__file"
link_test_local = local.Local(
target_host='localhost',
out_path=self.out_path,
exec_path=test.cdist_exec_path,
)
link_test_local._create_conf_path_and_link_conf_dirs()
our_type_dir = os.path.join(link_test_local.type_path, test_type)
self.assertTrue(os.path.isdir(our_type_dir))
def test_added_conf_dir_linking(self):
"""Ensure that links are correctly created for types in added conf directories"""
test_type="__cdist_test_type"
link_test_local = local.Local(
target_host='localhost',
out_path=self.out_path,
exec_path=test.cdist_exec_path,
add_conf_dirs=[conf_dir]
)
link_test_local._create_conf_path_and_link_conf_dirs()
our_type_dir = os.path.join(link_test_local.type_path, test_type)
self.assertTrue(os.path.isdir(our_type_dir))
### other tests
def test_run_success(self):