From 73bdb7f11f345aaa6ed7a360d8ae92ebd8bb047f Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 22:49:09 +0200 Subject: [PATCH] test and fixtures for Type members (name, path, ...) Signed-off-by: Steven Armstrong --- .../test/type/fixtures/__name_path/.keep | 0 lib/cdist/test/type/test_type.py | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 lib/cdist/test/type/fixtures/__name_path/.keep diff --git a/lib/cdist/test/type/fixtures/__name_path/.keep b/lib/cdist/test/type/fixtures/__name_path/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/test_type.py b/lib/cdist/test/type/test_type.py index 99ef3820..140e5349 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -31,6 +31,42 @@ fixtures = op.join(my_dir, 'fixtures') class TypeTestCase(unittest.TestCase): + + def test_name(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.name, '__name_path') + + def test_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.path, '__name_path') + + def test_absolute_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.absolute_path, os.path.join(base_path, '__name_path')) + + def test_manifest_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.manifest_path, os.path.join('__name_path', 'manifest')) + + def test_explorer_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.explorer_path, os.path.join('__name_path', 'explorer')) + + def test_gencode_local_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.gencode_local_path, os.path.join('__name_path', 'gencode-local')) + + def test_gencode_remote_path(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__name_path') + self.assertEqual(cdist_type.gencode_remote_path, os.path.join('__name_path', 'gencode-remote')) + def test_singleton_is_singleton(self): base_path = fixtures cdist_type = cdist.core.Type(base_path, '__singleton')