From f46344effe9794481b4f2fddd3e967683e6e8d87 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 22:51:06 +0200 Subject: [PATCH] test and fixtures for Type.list_* Signed-off-by: Steven Armstrong --- .../test/type/fixtures/list_types/__first/.keep | 0 .../test/type/fixtures/list_types/__second/.keep | 0 .../test/type/fixtures/list_types/__third/.keep | 0 lib/cdist/test/type/test_type.py | 14 ++++++++++++++ 4 files changed, 14 insertions(+) create mode 100644 lib/cdist/test/type/fixtures/list_types/__first/.keep create mode 100644 lib/cdist/test/type/fixtures/list_types/__second/.keep create mode 100644 lib/cdist/test/type/fixtures/list_types/__third/.keep diff --git a/lib/cdist/test/type/fixtures/list_types/__first/.keep b/lib/cdist/test/type/fixtures/list_types/__first/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/fixtures/list_types/__second/.keep b/lib/cdist/test/type/fixtures/list_types/__second/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/fixtures/list_types/__third/.keep b/lib/cdist/test/type/fixtures/list_types/__third/.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 1c8d10aa..5ba1f4b9 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -31,6 +31,20 @@ fixtures = op.join(my_dir, 'fixtures') class TypeTestCase(unittest.TestCase): + def test_list_type_names(self): + base_path = op.join(fixtures, 'list_types') + type_names = cdist.core.Type.list_type_names(base_path) + self.assertEqual(type_names, ['__first', '__second', '__third']) + + def test_list_types(self): + base_path = op.join(fixtures, 'list_types') + types = list(cdist.core.Type.list_types(base_path)) + types_expected = [ + cdist.core.Type(base_path, '__first'), + cdist.core.Type(base_path, '__second'), + cdist.core.Type(base_path, '__third'), + ] + self.assertEqual(types, types_expected) def test_only_one_instance(self): base_path = fixtures