From: Jelte Jansen Date: Sun, 30 Sep 2012 10:31:31 +0000 (+0200) Subject: [2254] direct test for find_spec_part change X-Git-Tag: trac2402_base~83^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=971e8bc5f615ebf009a4b1a60998151054ca34a5;p=thirdparty%2Fkea.git [2254] direct test for find_spec_part change --- diff --git a/src/lib/python/isc/config/tests/config_data_test.py b/src/lib/python/isc/config/tests/config_data_test.py index 1a5c92f870..444c2520b5 100644 --- a/src/lib/python/isc/config/tests/config_data_test.py +++ b/src/lib/python/isc/config/tests/config_data_test.py @@ -394,6 +394,27 @@ class TestMultiConfigData(unittest.TestCase): spec_part = self.mcd.find_spec_part("Spec2/item1") self.assertEqual({'item_name': 'item1', 'item_type': 'integer', 'item_optional': False, 'item_default': 1, }, spec_part) + # For lists, either the spec of the list itself, or the + # spec for the list contents should be returned (the + # latter when an index is given in the identifier) + spec_part = self.mcd.find_spec_part("Spec2/item5") + self.assertEqual({'item_default': ['a', 'b'], + 'item_name': 'item5', + 'item_optional': False, + 'item_type': 'list', + 'list_item_spec': {'item_default': '', + 'item_name': 'list_element', + 'item_optional': False, + 'item_type': 'string'}}, + spec_part) + spec_part = self.mcd.find_spec_part("Spec2/item5[0]") + self.assertEqual({'item_default': '', + 'item_name': 'list_element', + 'item_optional': False, + 'item_type': 'string'}, + spec_part) + + def test_find_spec_part_nested(self): module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec30.spec") self.mcd.set_specification(module_spec)