[svn] commit: r2477 - in /branches/trac221b/src/bin/xfrin: tests/xfrin_test.py xfrin.py.in

BIND 10 source code commits bind10-changes at lists.isc.org
Sat Jul 10 07:56:11 UTC 2010


Author: jinmei
Date: Sat Jul 10 07:56:11 2010
New Revision: 2477

Log:
use a string instead of an object for the RRclass parameter for xfrin/notify.
add validation of the given string.
adjust/add tests for this change.

Modified:
    branches/trac221b/src/bin/xfrin/tests/xfrin_test.py
    branches/trac221b/src/bin/xfrin/xfrin.py.in

Modified: branches/trac221b/src/bin/xfrin/tests/xfrin_test.py
==============================================================================
--- branches/trac221b/src/bin/xfrin/tests/xfrin_test.py (original)
+++ branches/trac221b/src/bin/xfrin/tests/xfrin_test.py Sat Jul 10 07:56:11 2010
@@ -430,8 +430,12 @@
         self.assertEqual(master_addrinfo[4][0], TEST_MASTER_IPV6_ADDRESS)
 
     def test_parse_cmd_params_chclass(self):
-        self.args['rrclass'] = RRClass.CH()
+        self.args['rrclass'] = 'CH'
         self.assertEqual(self._do_parse()[1], RRClass.CH())
+
+    def test_parse_cmd_params_bogusclass(self):
+        self.args['rrclass'] = 'XXX'
+        self.assertRaises(XfrinException, self._do_parse)
 
     def test_parse_cmd_params_nozone(self):
         # zone name is mandatory.

Modified: branches/trac221b/src/bin/xfrin/xfrin.py.in
==============================================================================
--- branches/trac221b/src/bin/xfrin/xfrin.py.in (original)
+++ branches/trac221b/src/bin/xfrin/xfrin.py.in Sat Jul 10 07:56:11 2010
@@ -440,6 +440,11 @@
             # the class is passed in the command arg (where we specify
             # the default)
             rrclass = RRClass.IN()
+        else:
+            try:
+                rrclass = RRClass(rrclass)
+            except InvalidRRClass as e:
+                raise XfrinException('invalid RRClass: ' + rrclass)
 
         master = args.get('master')
         if not master:




More information about the bind10-changes mailing list