[svn] commit: r4114 - in /branches/trac468/src/lib/python/isc/config: module_spec.py tests/module_spec_test.py
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Dec 31 21:53:37 UTC 2010
Author: jinmei
Date: Fri Dec 31 21:53:37 2010
New Revision: 4114
Log:
fixed a bug in command validation that it raises an exception when the command doesn't have a bug (trac #468)
Modified:
branches/trac468/src/lib/python/isc/config/module_spec.py
branches/trac468/src/lib/python/isc/config/tests/module_spec_test.py
Modified: branches/trac468/src/lib/python/isc/config/module_spec.py
==============================================================================
--- branches/trac468/src/lib/python/isc/config/module_spec.py (original)
+++ branches/trac468/src/lib/python/isc/config/module_spec.py Fri Dec 31 21:53:37 2010
@@ -339,6 +339,8 @@
# check if there are items in our data that are not in the
# specification
+ if not data:
+ return validated
for item_name in data:
found = False
for spec_item in module_spec:
Modified: branches/trac468/src/lib/python/isc/config/tests/module_spec_test.py
==============================================================================
--- branches/trac468/src/lib/python/isc/config/tests/module_spec_test.py (original)
+++ branches/trac468/src/lib/python/isc/config/tests/module_spec_test.py Fri Dec 31 21:53:37 2010
@@ -109,6 +109,11 @@
return dd.validate_command(cmd_name, params)
def test_command_validation(self):
+ # tests for a command that doesn't take an argument
+ self.assertEqual(True, self.read_spec_file("spec2.spec").validate_command("shutdown", None));
+ self.assertEqual(False, self.read_spec_file("spec2.spec").validate_command("shutdown", '{"val": 1}'));
+
+ # tests for a command taking arguments
self.assertEqual(True, self.validate_command_params("spec27.spec", "data22_1.data", 'cmd1'))
self.assertEqual(False, self.validate_command_params("spec27.spec", "data22_2.data",'cmd1'))
self.assertEqual(False, self.validate_command_params("spec27.spec", "data22_3.data", 'cmd1'))
More information about the bind10-changes
mailing list