From 8d3cad1815671d3b74b23ef46ff8a89a92e34d67 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 7 Oct 2011 22:32:55 +0200 Subject: [PATCH] test and fixtures for Type.{required,optional}_parameters Signed-off-by: Steven Armstrong --- .../parameter/optional | 2 ++ .../parameter/required | 2 ++ .../__without_optional_parameters/.keep | 0 .../__without_required_parameters/.keep | 0 lib/cdist/test/type/test_type.py | 19 +++++++++++++++++++ 5 files changed, 23 insertions(+) create mode 100644 lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional create mode 100644 lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required create mode 100644 lib/cdist/test/type/fixtures/__without_optional_parameters/.keep create mode 100644 lib/cdist/test/type/fixtures/__without_required_parameters/.keep diff --git a/lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional b/lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional new file mode 100644 index 00000000..8174d2a9 --- /dev/null +++ b/lib/cdist/test/type/fixtures/__with_optional_parameters/parameter/optional @@ -0,0 +1,2 @@ +optional1 +optional2 diff --git a/lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required b/lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required new file mode 100644 index 00000000..e0fba2c9 --- /dev/null +++ b/lib/cdist/test/type/fixtures/__with_required_parameters/parameter/required @@ -0,0 +1,2 @@ +required1 +required2 diff --git a/lib/cdist/test/type/fixtures/__without_optional_parameters/.keep b/lib/cdist/test/type/fixtures/__without_optional_parameters/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/cdist/test/type/fixtures/__without_required_parameters/.keep b/lib/cdist/test/type/fixtures/__without_required_parameters/.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 49cc3a34..99ef3820 100644 --- a/lib/cdist/test/type/test_type.py +++ b/lib/cdist/test/type/test_type.py @@ -61,6 +61,25 @@ class TypeTestCase(unittest.TestCase): cdist_type = cdist.core.Type(base_path, '__without_explorers') self.assertEqual(cdist_type.explorers, []) + def test_with_required_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__with_required_parameters') + self.assertEqual(cdist_type.required_parameters, ['required1', 'required2']) + + def test_without_required_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__without_required_parameters') + self.assertEqual(cdist_type.required_parameters, []) + + def test_with_optional_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__with_optional_parameters') + self.assertEqual(cdist_type.optional_parameters, ['optional1', 'optional2']) + + def test_without_optional_parameters(self): + base_path = fixtures + cdist_type = cdist.core.Type(base_path, '__without_optional_parameters') + self.assertEqual(cdist_type.optional_parameters, []) ''' suite = unittest.TestLoader().loadTestsFromTestCase(ObjectTestCase)