Browse Source

[2689] a bit of cleanup: rename some internal methods and add comments.

"check" in __check_group_recvmsg was added for a historical reason and
is not really appropriate any more (it doesn't do any check internally)
JINMEI Tatuya 12 years ago
parent
commit
d6e34fc0d9
1 changed files with 11 additions and 5 deletions
  1. 11 5
      src/bin/stats/tests/test_utils.py

+ 11 - 5
src/bin/stats/tests/test_utils.py

@@ -522,8 +522,8 @@ class SimpleStats(stats.Stats):
         # _init_statistics_data.  This will get the Stats module info from
         # _init_statistics_data.  This will get the Stats module info from
         # the file directly and some amount information about the Init and
         # the file directly and some amount information about the Init and
         # Auth modules (hardcoded below).
         # Auth modules (hardcoded below).
-        self.cc_session.group_sendmsg = self.__check_group_sendmsg
-        self.cc_session.group_recvmsg = self.__check_group_recvmsg
+        self.cc_session.group_sendmsg = self.__group_sendmsg
+        self.cc_session.group_recvmsg = self.__group_recvmsg
         self.cc_session.rpc_call = self.__rpc_call
         self.cc_session.rpc_call = self.__rpc_call
         stats.Stats._init_statistics_data(self)
         stats.Stats._init_statistics_data(self)
 
 
@@ -556,7 +556,7 @@ class SimpleStats(stats.Stats):
         # initialization until we are ready.
         # initialization until we are ready.
         pass
         pass
 
 
-    def __check_group_sendmsg(self, command, destination, want_answer=False):
+    def __group_sendmsg(self, command, destination, want_answer=False):
         """Faked ModuleCCSession.group_sendmsg for tests.
         """Faked ModuleCCSession.group_sendmsg for tests.
 
 
         Skipping actual network communication, and just returning an internally
         Skipping actual network communication, and just returning an internally
@@ -566,7 +566,7 @@ class SimpleStats(stats.Stats):
         self.__seq += 1
         self.__seq += 1
         return self.__seq
         return self.__seq
 
 
-    def __check_group_recvmsg(self, nonblocking, seq):
+    def __group_recvmsg(self, nonblocking, seq):
         """Faked ModuleCCSession.group_recvmsg for tests.
         """Faked ModuleCCSession.group_recvmsg for tests.
 
 
         Skipping actual network communication, and returning an internally
         Skipping actual network communication, and returning an internally
@@ -580,7 +580,13 @@ class SimpleStats(stats.Stats):
         return self._answers.pop(0)
         return self._answers.pop(0)
 
 
     def __rpc_call(self, command, group):
     def __rpc_call(self, command, group):
-        answer, _ = self.__check_group_recvmsg(None, None)
+        """Faked ModuleCCSession.rpc_call for tests.
+
+        At the moment we don't have to cover failure cases, so this is a
+        simple wrapper for the faked group_recvmsg().
+
+        """
+        answer, _ = self.__group_recvmsg(None, None)
         return isc.config.ccsession.parse_answer(answer)[1]
         return isc.config.ccsession.parse_answer(answer)[1]
 
 
 class MyStats(stats.Stats):
 class MyStats(stats.Stats):