test for debug in manifest

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-10-14 23:18:58 +02:00
parent f80520090b
commit df8be73c10

View file

@ -26,9 +26,7 @@ import getpass
import shutil import shutil
import string import string
import random import random
import logging
#import logging
#logging.basicConfig(level=logging.DEBUG, format='%(levelname)s: %(message)s')
import cdist import cdist
from cdist.exec import local from cdist.exec import local
@ -51,12 +49,13 @@ class ManifestTestCase(unittest.TestCase):
def setUp(self): def setUp(self):
self.temp_dir = self.mkdtemp() self.temp_dir = self.mkdtemp()
target_host = 'localhost' self.target_host = 'localhost'
out_path = self.temp_dir out_path = self.temp_dir
self.local = local.Local(target_host, local_base_path, out_path) self.local = local.Local(self.target_host, local_base_path, out_path)
self.local.create_directories() self.local.create_directories()
self.local.link_emulator(cdist.test.cdist_exec_path) self.local.link_emulator(cdist.test.cdist_exec_path)
self.manifest = manifest.Manifest(target_host, self.local) self.manifest = manifest.Manifest(self.target_host, self.local)
self.log = logging.getLogger("cdist")
def tearDown(self): def tearDown(self):
shutil.rmtree(self.temp_dir) shutil.rmtree(self.temp_dir)
@ -69,3 +68,8 @@ class ManifestTestCase(unittest.TestCase):
cdist_type = core.Type(self.local.type_path, '__dump_environment') cdist_type = core.Type(self.local.type_path, '__dump_environment')
cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever') cdist_object = core.Object(cdist_type, self.local.object_path, 'whatever')
self.manifest.run_type_manifest(cdist_object) self.manifest.run_type_manifest(cdist_object)
def test_debug_env_setup(self):
self.log.setLevel(logging.DEBUG)
manifest = cdist.core.manifest.Manifest(self.target_host, self.local)
self.assertTrue("__debug" in manifest.env)