From f3b942e591423c09e71e92af32887d6782f3d5ee Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Mon, 10 Oct 2011 09:34:16 +0200 Subject: [PATCH] test for Object paths Signed-off-by: Steven Armstrong --- lib/cdist/test/object/__init__.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/cdist/test/object/__init__.py b/lib/cdist/test/object/__init__.py index 3d04a7a3..c1685c58 100644 --- a/lib/cdist/test/object/__init__.py +++ b/lib/cdist/test/object/__init__.py @@ -52,10 +52,28 @@ class ObjectClassTestCase(unittest.TestCase): self.assertEqual(objects, objects_expected) -''' -suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase) +class ObjectTestCase(unittest.TestCase): -def suite(): - tests = [] - return unittest.TestSuite(map(ObjectTestCase, tests)) -''' + def setUp(self): + self.cdist_type = cdist.core.Type(type_base_path, '__third') + self.cdist_object = cdist.core.Object(self.cdist_type, object_base_path, 'moon') + + def test_name(self): + self.assertEqual(self.cdist_object.name, '__third/moon') + + def test_path(self): + self.assertEqual(self.cdist_object.path, '__third/moon/.cdist') + + def test_absolute_path(self): + self.assertEqual(self.cdist_object.absolute_path, os.path.join(object_base_path, '__third/moon/.cdist')) + + def test_code_local_path(self): + self.assertEqual(self.cdist_object.code_local_path, '__third/moon/.cdist/code-local') + + def test_code_remote_path(self): + self.assertEqual(self.cdist_object.code_remote_path, '__third/moon/.cdist/code-remote') + + def test_parameter_path(self): + self.assertEqual(self.cdist_object.parameter_path, '__third/moon/.cdist/parameter') + +#suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase)