From 12e5b3e8dc2c480c3359499a9bef8c49222c93b7 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 15:00:07 +0200 Subject: [PATCH] test for run_code_local Signed-off-by: Steven Armstrong --- lib/cdist/test/code/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/cdist/test/code/__init__.py b/lib/cdist/test/code/__init__.py index be4530d8..a6e12e06 100644 --- a/lib/cdist/test/code/__init__.py +++ b/lib/cdist/test/code/__init__.py @@ -105,6 +105,20 @@ class ExplorerClassTestCase(unittest.TestCase): destination = os.path.join(self.remote.object_path, self.cdist_object.code_remote_path) self.assertTrue(os.path.isfile(destination)) + def test_run_code_local_environment(self): + self.cdist_object.code_local = self.code.run_gencode_local(self.cdist_object) + output_string = self.code.run_code_local(self.cdist_object) + output_dict = {} + for line in output_string.split('\n'): + if line: + key,value = line.split(': ') + output_dict[key] = value + self.assertEqual(output_dict['__target_host'], self.local.target_host) + self.assertEqual(output_dict['__global'], self.local.out_path) + self.assertEqual(output_dict['__type'], self.cdist_type.absolute_path) + self.assertEqual(output_dict['__object'], self.cdist_object.absolute_path) + self.assertEqual(output_dict['__object_id'], self.cdist_object.object_id) + self.assertEqual(output_dict['__object_fq'], self.cdist_object.path) '''