Browse Source

[1843] add test for change to find_spec_part

and a bit of comment cleanup
Jelte Jansen 13 years ago
parent
commit
bed1681e32

+ 2 - 2
src/bin/bindctl/bindcmd.py

@@ -781,8 +781,8 @@ class BindCmdInterpreter(Cmd):
            The execution is stopped if there are any errors.
         '''
         verbose = False
-        # TODO: revert local changes on failure
-        # make sure it's a copy
+        # Keep a copy of the original local changes, in case the
+        # given command set changes things but fails later
         local_changes_backup =\
             copy.deepcopy(self.config_data.get_local_changes())
         try:

+ 0 - 1
src/lib/python/isc/config/ccsession.py

@@ -559,7 +559,6 @@ class UIModuleCCSession(MultiConfigData):
                                                           " already in " +
                                                           identifier)
 
-
     def add_value(self, identifier, value_str = None, set_value_str = None):
         """Add a value to a configuration list. Raises a DataTypeError
            if the value does not conform to the list_item_spec field

+ 4 - 0
src/lib/python/isc/config/tests/config_data_test.py

@@ -186,6 +186,10 @@ class TestConfigData(unittest.TestCase):
         spec_part = find_spec_part(config_spec, "item6/value1")
         self.assertEqual({'item_name': 'value1', 'item_type': 'string', 'item_optional': True, 'item_default': 'default'}, spec_part)
 
+        # make sure the returned data is a copy
+        spec_part['item_default'] = 'foo'
+        self.assertNotEqual(spec_part, find_spec_part(config_spec, "item6/value1"))
+
     def test_find_spec_part_lists(self):
         # A few specific tests for list data
         module_spec = isc.config.module_spec_from_file(self.data_path +