Browse Source

[2964] small refactoring: move more stuff from mock _cc_setup to ctor.

so we can test much larger part of _cc_setup().  right now no behavior change.
JINMEI Tatuya 12 years ago
parent
commit
8b143c88e7
2 changed files with 8 additions and 7 deletions
  1. 0 3
      src/bin/xfrin/tests/xfrin_test.py
  2. 8 4
      src/bin/xfrin/xfrin.py.in

+ 0 - 3
src/bin/xfrin/tests/xfrin_test.py

@@ -250,10 +250,7 @@ class MockXfrin(Xfrin):
     check_command_hook = None
 
     def _cc_setup(self):
-        self._tsig_key = None
         self._module_cc = MockCC()
-        init_keyring(self._module_cc)
-        pass
 
     def _get_db_file(self):
         pass

+ 8 - 4
src/bin/xfrin/xfrin.py.in

@@ -1454,11 +1454,16 @@ class Xfrin:
         # is used to trigger Auth/in-memory so that it reloads
         # zones when they have been transfered in
         self._memory_zones = set()
-        self._cc_setup()
         self.recorder = XfrinRecorder()
         self._shutdown_event = threading.Event()
         self._counters = Counters(SPECFILE_LOCATION)
 
+        # Initial configuration
+        self._cc_setup()
+        config_data = self._module_cc.get_full_config()
+        self.config_handler(config_data)
+        init_keyring(self._module_cc)
+
     def _cc_setup(self):
         '''This method is used only as part of initialization, but is
         implemented separately for convenience of unit tests; by letting
@@ -1471,11 +1476,10 @@ class Xfrin:
                                               self.config_handler,
                                               self.command_handler)
         self._module_cc.start()
-        config_data = self._module_cc.get_full_config()
-        self.config_handler(config_data)
+        # TBD: this will be removed in this branch
         self._module_cc.add_remote_config(AUTH_SPECFILE_LOCATION,
                                           self._auth_config_handler)
-        init_keyring(self._module_cc)
+        # END_OF_TBD
 
     def _cc_check_command(self):
         '''This is a straightforward wrapper for cc.check_command,