[svn] commit: r3196 - in /branches/trac340/src/bin/zonemgr: tests/zonemgr_test.py zonemgr.py.in

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Oct 13 04:53:20 UTC 2010


Author: chenzhengzhang
Date: Wed Oct 13 04:53:20 2010
New Revision: 3196

Log:
update unittest

Modified:
    branches/trac340/src/bin/zonemgr/tests/zonemgr_test.py
    branches/trac340/src/bin/zonemgr/zonemgr.py.in

Modified: branches/trac340/src/bin/zonemgr/tests/zonemgr_test.py
==============================================================================
--- branches/trac340/src/bin/zonemgr/tests/zonemgr_test.py (original)
+++ branches/trac340/src/bin/zonemgr/tests/zonemgr_test.py Wed Oct 13 04:53:20 2010
@@ -444,10 +444,10 @@
         self._cc = MySession()
         self._module_cc = MyCCSession()
         self._config_data = {
-                    "lowerbound_refresh" : "10", 
-                    "lowerbound_retry" : "5", 
-                    "max_transfer_timeout" : "14400",
-                    "jitter_scope" : "0.1"
+                    "lowerbound_refresh" : 10, 
+                    "lowerbound_retry" : 5, 
+                    "max_transfer_timeout" : 14400,
+                    "jitter_scope" : 0.1
                     }
 
     def _start_zone_refresh_timer(self):
@@ -460,10 +460,10 @@
 
     def test_config_handler(self):
         config_data1 = {
-                    "lowerbound_refresh" : "60", 
-                    "lowerbound_retry" : "30", 
-                    "max_transfer_timeout" : "14400",
-                    "jitter_scope" : "0.1"
+                    "lowerbound_refresh" : 60, 
+                    "lowerbound_retry" : 30, 
+                    "max_transfer_timeout" : 14400,
+                    "jitter_scope" : 0.1
                     }
         self.zonemgr.config_handler(config_data1)
         self.assertEqual(config_data1, self.zonemgr._config_data)
@@ -471,9 +471,9 @@
         self.zonemgr.config_handler(config_data2)
         self.assertEqual(config_data1, self.zonemgr._config_data)
         # jitter should not be bigger than half of the original value
-        config_data3 = {"jitter_scope" : "0.7"}
+        config_data3 = {"jitter_scope" : 0.7}
         self.zonemgr.config_handler(config_data3)
-        self.assertEqual("0.5", self.zonemgr._config_data.get("jitter_scope"))
+        self.assertEqual(0.5, self.zonemgr._config_data.get("jitter_scope"))
 
     def test_get_db_file(self):
         self.assertEqual("initdb.file", self.zonemgr.get_db_file())

Modified: branches/trac340/src/bin/zonemgr/zonemgr.py.in
==============================================================================
--- branches/trac340/src/bin/zonemgr/zonemgr.py.in (original)
+++ branches/trac340/src/bin/zonemgr/zonemgr.py.in Wed Oct 13 04:53:20 2010
@@ -392,7 +392,7 @@
         self._module_cc.add_remote_config(AUTH_SPECFILE_LOCATION)
         self._config_data = self._module_cc.get_full_config()
         # jitter should not be bigger than half of the original value
-        if float(self._config_data.get('jitter_scope')) > 0.5:
+        if self._config_data.get('jitter_scope') > 0.5:
             self._config_data['jitter_scope'] = 0.5
             log_msg("[b10-zonemgr] jitter_scope should not be bigger than 0.5.") 
         self._module_cc.start()
@@ -429,7 +429,7 @@
                 continue
             # jitter should not be bigger than half of the original value
             if key == 'jitter_scope':
-                if float(new_config.get(key)) > 0.5:
+                if new_config.get(key) > 0.5:
                     new_config[key] = 0.5
                     log_msg("[b10-zonemgr] jitter_scope should not be bigger than 0.5.") 
             self._config_data[key] = new_config[key]




More information about the bind10-changes mailing list