Browse Source

[2823] renamed "SimpleXXX" classes to "MyXXX", as they are not really simple.

JINMEI Tatuya 12 years ago
parent
commit
79d4b47018

+ 29 - 29
src/bin/stats/tests/b10-stats-httpd_test.py

@@ -47,7 +47,7 @@ import isc.log
 import stats_httpd
 import stats_httpd
 import stats
 import stats
 from test_utils import ThreadingServerManager, SignalHandler, \
 from test_utils import ThreadingServerManager, SignalHandler, \
-    SimpleStatsHttpd, CONST_BASETIME
+    MyStatsHttpd, CONST_BASETIME
 from isc.testutils.ccsession_mock import MockModuleCCSession
 from isc.testutils.ccsession_mock import MockModuleCCSession
 from isc.config import RPCRecipientMissing, RPCError
 from isc.config import RPCRecipientMissing, RPCError
 
 
@@ -237,7 +237,7 @@ class TestHttpHandler(unittest.TestCase):
         self.sig_handler = SignalHandler(self.fail)
         self.sig_handler = SignalHandler(self.fail)
         DUMMY_DATA['Stats']['lname'] = 'test-lname'
         DUMMY_DATA['Stats']['lname'] = 'test-lname'
         (self.address, self.port) = get_availaddr()
         (self.address, self.port) = get_availaddr()
-        self.stats_httpd_server = ThreadingServerManager(SimpleStatsHttpd,
+        self.stats_httpd_server = ThreadingServerManager(MyStatsHttpd,
                                                          (self.address,
                                                          (self.address,
                                                           self.port))
                                                           self.port))
         self.stats_httpd = self.stats_httpd_server.server
         self.stats_httpd = self.stats_httpd_server.server
@@ -571,7 +571,7 @@ class TestHttpServer(unittest.TestCase):
         self.sig_handler.reset()
         self.sig_handler.reset()
 
 
     def test_httpserver(self):
     def test_httpserver(self):
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.assertEqual(type(self.stats_httpd.httpd), list)
         self.assertEqual(type(self.stats_httpd.httpd), list)
         self.assertEqual(len(self.stats_httpd.httpd), 1)
         self.assertEqual(len(self.stats_httpd.httpd), 1)
         for httpd in self.stats_httpd.httpd:
         for httpd in self.stats_httpd.httpd:
@@ -624,7 +624,7 @@ class TestStatsHttpd(unittest.TestCase):
 
 
     def test_init(self):
     def test_init(self):
         server_address = get_availaddr()
         server_address = get_availaddr()
-        self.stats_httpd = SimpleStatsHttpd(server_address)
+        self.stats_httpd = MyStatsHttpd(server_address)
         self.assertEqual(self.stats_httpd.running, False)
         self.assertEqual(self.stats_httpd.running, False)
         self.assertEqual(self.stats_httpd.poll_intval, 0.5)
         self.assertEqual(self.stats_httpd.poll_intval, 0.5)
         self.assertNotEqual(len(self.stats_httpd.httpd), 0)
         self.assertNotEqual(len(self.stats_httpd.httpd), 0)
@@ -642,13 +642,13 @@ class TestStatsHttpd(unittest.TestCase):
                              get_module_spec().get_module_name())
                              get_module_spec().get_module_name())
 
 
     def test_init_hterr(self):
     def test_init_hterr(self):
-        class FailingStatsHttpd(SimpleStatsHttpd):
+        class FailingStatsHttpd(MyStatsHttpd):
             def open_httpd(self):
             def open_httpd(self):
                 raise stats_httpd.HttpServerError
                 raise stats_httpd.HttpServerError
         self.assertRaises(stats_httpd.HttpServerError, FailingStatsHttpd)
         self.assertRaises(stats_httpd.HttpServerError, FailingStatsHttpd)
 
 
     def test_openclose_mccs(self):
     def test_openclose_mccs(self):
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         mccs = self.stats_httpd.mccs
         mccs = self.stats_httpd.mccs
         self.assertFalse(self.stats_httpd.mccs.stopped)
         self.assertFalse(self.stats_httpd.mccs.stopped)
         self.assertFalse(self.stats_httpd.mccs.closed)
         self.assertFalse(self.stats_httpd.mccs.closed)
@@ -663,7 +663,7 @@ class TestStatsHttpd(unittest.TestCase):
         self.assertEqual(self.stats_httpd.close_mccs(), None)
         self.assertEqual(self.stats_httpd.close_mccs(), None)
 
 
     def test_mccs(self):
     def test_mccs(self):
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.assertIsNotNone(self.stats_httpd.mccs.get_socket())
         self.assertIsNotNone(self.stats_httpd.mccs.get_socket())
         self.assertTrue(
         self.assertTrue(
             isinstance(self.stats_httpd.mccs.get_socket(), socket.socket))
             isinstance(self.stats_httpd.mccs.get_socket(), socket.socket))
@@ -682,7 +682,7 @@ class TestStatsHttpd(unittest.TestCase):
         # dual stack (addresses is ipv4 and ipv6)
         # dual stack (addresses is ipv4 and ipv6)
         if self.ipv6_enabled:
         if self.ipv6_enabled:
             server_addresses = (get_availaddr('::1'), get_availaddr())
             server_addresses = (get_availaddr('::1'), get_availaddr())
-            self.stats_httpd = SimpleStatsHttpd(*server_addresses)
+            self.stats_httpd = MyStatsHttpd(*server_addresses)
             for ht in self.stats_httpd.httpd:
             for ht in self.stats_httpd.httpd:
                 self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
                 self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
                 self.assertTrue(ht.address_family in set([socket.AF_INET,
                 self.assertTrue(ht.address_family in set([socket.AF_INET,
@@ -694,7 +694,7 @@ class TestStatsHttpd(unittest.TestCase):
         # dual stack (address is ipv6)
         # dual stack (address is ipv6)
         if self.ipv6_enabled:
         if self.ipv6_enabled:
             server_addresses = get_availaddr('::1')
             server_addresses = get_availaddr('::1')
-            self.stats_httpd = SimpleStatsHttpd(server_addresses)
+            self.stats_httpd = MyStatsHttpd(server_addresses)
             for ht in self.stats_httpd.httpd:
             for ht in self.stats_httpd.httpd:
                 self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
                 self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
                 self.assertEqual(ht.address_family, socket.AF_INET6)
                 self.assertEqual(ht.address_family, socket.AF_INET6)
@@ -704,7 +704,7 @@ class TestStatsHttpd(unittest.TestCase):
 
 
         # dual/single stack (address is ipv4)
         # dual/single stack (address is ipv4)
         server_addresses = get_availaddr()
         server_addresses = get_availaddr()
-        self.stats_httpd = SimpleStatsHttpd(server_addresses)
+        self.stats_httpd = MyStatsHttpd(server_addresses)
         for ht in self.stats_httpd.httpd:
         for ht in self.stats_httpd.httpd:
             self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
             self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
             self.assertEqual(ht.address_family, socket.AF_INET)
             self.assertEqual(ht.address_family, socket.AF_INET)
@@ -715,7 +715,7 @@ class TestStatsHttpd(unittest.TestCase):
     def test_httpd_anyIPv4(self):
     def test_httpd_anyIPv4(self):
         # any address (IPv4)
         # any address (IPv4)
         server_addresses = get_availaddr(address='0.0.0.0')
         server_addresses = get_availaddr(address='0.0.0.0')
-        self.stats_httpd = SimpleStatsHttpd(server_addresses)
+        self.stats_httpd = MyStatsHttpd(server_addresses)
         for ht in self.stats_httpd.httpd:
         for ht in self.stats_httpd.httpd:
             self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
             self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
             self.assertEqual(ht.address_family,socket.AF_INET)
             self.assertEqual(ht.address_family,socket.AF_INET)
@@ -725,7 +725,7 @@ class TestStatsHttpd(unittest.TestCase):
         # any address (IPv6)
         # any address (IPv6)
         if self.ipv6_enabled:
         if self.ipv6_enabled:
             server_addresses = get_availaddr(address='::')
             server_addresses = get_availaddr(address='::')
-            self.stats_httpd = SimpleStatsHttpd(server_addresses)
+            self.stats_httpd = MyStatsHttpd(server_addresses)
             for ht in self.stats_httpd.httpd:
             for ht in self.stats_httpd.httpd:
                 self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
                 self.assertTrue(isinstance(ht, stats_httpd.HttpServer))
                 self.assertEqual(ht.address_family,socket.AF_INET6)
                 self.assertEqual(ht.address_family,socket.AF_INET6)
@@ -733,29 +733,29 @@ class TestStatsHttpd(unittest.TestCase):
 
 
     def test_httpd_failed(self):
     def test_httpd_failed(self):
         # existent hostname
         # existent hostname
-        self.assertRaises(stats_httpd.HttpServerError, SimpleStatsHttpd,
+        self.assertRaises(stats_httpd.HttpServerError, MyStatsHttpd,
                           get_availaddr(address='localhost'))
                           get_availaddr(address='localhost'))
 
 
         # nonexistent hostname
         # nonexistent hostname
-        self.assertRaises(stats_httpd.HttpServerError, SimpleStatsHttpd,
+        self.assertRaises(stats_httpd.HttpServerError, MyStatsHttpd,
                           ('my.host.domain', 8000))
                           ('my.host.domain', 8000))
 
 
         # over flow of port number
         # over flow of port number
-        self.assertRaises(stats_httpd.HttpServerError, SimpleStatsHttpd,
+        self.assertRaises(stats_httpd.HttpServerError, MyStatsHttpd,
                           ('127.0.0.1', 80000))
                           ('127.0.0.1', 80000))
 
 
         # negative
         # negative
-        self.assertRaises(stats_httpd.HttpServerError, SimpleStatsHttpd,
+        self.assertRaises(stats_httpd.HttpServerError, MyStatsHttpd,
                           ('127.0.0.1', -8000))
                           ('127.0.0.1', -8000))
 
 
         # alphabet
         # alphabet
-        self.assertRaises(stats_httpd.HttpServerError, SimpleStatsHttpd,
+        self.assertRaises(stats_httpd.HttpServerError, MyStatsHttpd,
                           ('127.0.0.1', 'ABCDE'))
                           ('127.0.0.1', 'ABCDE'))
 
 
         # Address already in use
         # Address already in use
         server_addresses = get_availaddr()
         server_addresses = get_availaddr()
-        server = SimpleStatsHttpd(server_addresses)
+        server = MyStatsHttpd(server_addresses)
-        self.assertRaises(stats_httpd.HttpServerError, SimpleStatsHttpd,
+        self.assertRaises(stats_httpd.HttpServerError, MyStatsHttpd,
                           server_addresses)
                           server_addresses)
 
 
     def __faked_select(self, ex=None):
     def __faked_select(self, ex=None):
@@ -783,7 +783,7 @@ class TestStatsHttpd(unittest.TestCase):
         # - as long as 'running' is True, it keeps calling select.select
         # - as long as 'running' is True, it keeps calling select.select
         # - when running becomes False, it exists from the loop and calls
         # - when running becomes False, it exists from the loop and calls
         #   stop()
         #   stop()
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.assertFalse(self.stats_httpd.running)
         self.assertFalse(self.stats_httpd.running)
 
 
         # In this test we'll call select.select() 2 times: on the first call
         # In this test we'll call select.select() 2 times: on the first call
@@ -798,7 +798,7 @@ class TestStatsHttpd(unittest.TestCase):
     def test_running_fail(self):
     def test_running_fail(self):
         # A failure case of start(): we close the (real but dummy) socket for
         # A failure case of start(): we close the (real but dummy) socket for
         # the CC session.  This breaks the select-loop due to exception
         # the CC session.  This breaks the select-loop due to exception
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.stats_httpd.mccs.get_socket().close()
         self.stats_httpd.mccs.get_socket().close()
         self.assertRaises(ValueError, self.stats_httpd.start)
         self.assertRaises(ValueError, self.stats_httpd.start)
 
 
@@ -808,7 +808,7 @@ class TestStatsHttpd(unittest.TestCase):
         def raise_select_except(*args):
         def raise_select_except(*args):
             raise select.error('dummy error')
             raise select.error('dummy error')
         select.select = raise_select_except
         select.select = raise_select_except
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.assertRaises(select.error, self.stats_httpd.start)
         self.assertRaises(select.error, self.stats_httpd.start)
 
 
     def test_nofailure_with_errno_EINTR(self):
     def test_nofailure_with_errno_EINTR(self):
@@ -817,13 +817,13 @@ class TestStatsHttpd(unittest.TestCase):
         self.__call_count = 0
         self.__call_count = 0
         select.select = lambda r, w, x, t: self.__faked_select(
         select.select = lambda r, w, x, t: self.__faked_select(
             select.error(errno.EINTR))
             select.error(errno.EINTR))
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.stats_httpd.start() # shouldn't leak the exception
         self.stats_httpd.start() # shouldn't leak the exception
         self.assertFalse(self.stats_httpd.running)
         self.assertFalse(self.stats_httpd.running)
         self.assertEqual(None, self.stats_httpd.mccs)
         self.assertEqual(None, self.stats_httpd.mccs)
 
 
     def test_open_template(self):
     def test_open_template(self):
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         # successful conditions
         # successful conditions
         tmpl = self.stats_httpd.open_template(
         tmpl = self.stats_httpd.open_template(
             stats_httpd.XML_TEMPLATE_LOCATION)
             stats_httpd.XML_TEMPLATE_LOCATION)
@@ -854,7 +854,7 @@ class TestStatsHttpd(unittest.TestCase):
             self.stats_httpd.open_template, '/path/to/foo/bar')
             self.stats_httpd.open_template, '/path/to/foo/bar')
 
 
     def test_commands(self):
     def test_commands(self):
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.assertEqual(self.stats_httpd.command_handler("status", None),
         self.assertEqual(self.stats_httpd.command_handler("status", None),
                          isc.config.ccsession.create_answer(
                          isc.config.ccsession.create_answer(
                 0, "Stats Httpd is up. (PID " + str(os.getpid()) + ")"))
                 0, "Stats Httpd is up. (PID " + str(os.getpid()) + ")"))
@@ -868,7 +868,7 @@ class TestStatsHttpd(unittest.TestCase):
                 1, "Unknown command: __UNKNOWN_COMMAND__"))
                 1, "Unknown command: __UNKNOWN_COMMAND__"))
 
 
     def test_config(self):
     def test_config(self):
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.assertEqual(
         self.assertEqual(
             self.stats_httpd.config_handler(dict(_UNKNOWN_KEY_=None)),
             self.stats_httpd.config_handler(dict(_UNKNOWN_KEY_=None)),
             isc.config.ccsession.create_answer(
             isc.config.ccsession.create_answer(
@@ -918,7 +918,7 @@ class TestStatsHttpd(unittest.TestCase):
 
 
     @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
     @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
     def test_xml_handler(self):
     def test_xml_handler(self):
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         module_name = 'Dummy'
         module_name = 'Dummy'
         stats_spec = \
         stats_spec = \
             { module_name :
             { module_name :
@@ -1037,7 +1037,7 @@ class TestStatsHttpd(unittest.TestCase):
 
 
     @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
     @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
     def test_xsd_handler(self):
     def test_xsd_handler(self):
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         xsd_string = self.stats_httpd.xsd_handler()
         xsd_string = self.stats_httpd.xsd_handler()
         stats_xsd = xml.etree.ElementTree.fromstring(xsd_string)
         stats_xsd = xml.etree.ElementTree.fromstring(xsd_string)
         ns = '{%s}' % XMLNS_XSD
         ns = '{%s}' % XMLNS_XSD
@@ -1072,7 +1072,7 @@ class TestStatsHttpd(unittest.TestCase):
 
 
     @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
     @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
     def test_xsl_handler(self):
     def test_xsl_handler(self):
-        self.stats_httpd = SimpleStatsHttpd(get_availaddr())
+        self.stats_httpd = MyStatsHttpd(get_availaddr())
         xsl_string = self.stats_httpd.xsl_handler()
         xsl_string = self.stats_httpd.xsl_handler()
         stats_xsl = xml.etree.ElementTree.fromstring(xsl_string)
         stats_xsl = xml.etree.ElementTree.fromstring(xsl_string)
         nst = '{%s}' % XMLNS_XSL
         nst = '{%s}' % XMLNS_XSL

+ 21 - 21
src/bin/stats/tests/b10-stats_test.py

@@ -30,7 +30,7 @@ import sys
 
 
 import stats
 import stats
 import isc.log
 import isc.log
-from test_utils import SimpleStats
+from test_utils import MyStats
 
 
 class TestUtilties(unittest.TestCase):
 class TestUtilties(unittest.TestCase):
     items = [
     items = [
@@ -258,7 +258,7 @@ class TestStats(unittest.TestCase):
         stats.get_datetime = self.__orig_get_datetime
         stats.get_datetime = self.__orig_get_datetime
 
 
     def test_init(self):
     def test_init(self):
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         self.assertEqual(self.stats.module_name, 'Stats')
         self.assertEqual(self.stats.module_name, 'Stats')
         self.assertFalse(self.stats.running)
         self.assertFalse(self.stats.running)
         self.assertTrue('command_show' in self.stats.callbacks)
         self.assertTrue('command_show' in self.stats.callbacks)
@@ -288,7 +288,7 @@ class TestStats(unittest.TestCase):
 """
 """
         orig_spec_location = stats.SPECFILE_LOCATION
         orig_spec_location = stats.SPECFILE_LOCATION
         stats.SPECFILE_LOCATION = io.StringIO(spec_str)
         stats.SPECFILE_LOCATION = io.StringIO(spec_str)
-        self.assertRaises(stats.StatsError, SimpleStats)
+        self.assertRaises(stats.StatsError, MyStats)
         stats.SPECFILE_LOCATION = orig_spec_location
         stats.SPECFILE_LOCATION = orig_spec_location
 
 
     def __send_command(self, stats, command_name, params=None):
     def __send_command(self, stats, command_name, params=None):
@@ -307,7 +307,7 @@ class TestStats(unittest.TestCase):
             raise CheckException # terminate the loop
             raise CheckException # terminate the loop
 
 
         # start without err
         # start without err
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         self.assertFalse(self.stats.running)
         self.assertFalse(self.stats.running)
         self.stats._check_command = lambda: __check_start(self.stats)
         self.stats._check_command = lambda: __check_start(self.stats)
         # We are going to confirm start() will set running to True, avoiding
         # We are going to confirm start() will set running to True, avoiding
@@ -325,7 +325,7 @@ class TestStats(unittest.TestCase):
             # override get_interval() so it won't go poll statistics
             # override get_interval() so it won't go poll statistics
             tested_stats.get_interval = lambda : 0
             tested_stats.get_interval = lambda : 0
 
 
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         self.stats._check_command = lambda: __check_shutdown(self.stats)
         self.stats._check_command = lambda: __check_shutdown(self.stats)
         self.stats.start()
         self.stats.start()
         self.assertTrue(self.stats.mccs.stopped)
         self.assertTrue(self.stats.mccs.stopped)
@@ -333,7 +333,7 @@ class TestStats(unittest.TestCase):
     def test_handlers(self):
     def test_handlers(self):
         """Test command_handler"""
         """Test command_handler"""
 
 
-        __stats = SimpleStats()
+        __stats = MyStats()
 
 
         # 'show' command.  We're going to check the expected methods are
         # 'show' command.  We're going to check the expected methods are
         # called in the expected order, and check the resulting response.
         # called in the expected order, and check the resulting response.
@@ -430,7 +430,7 @@ class TestStats(unittest.TestCase):
                         }]}
                         }]}
             return answer_value
             return answer_value
 
 
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         self.stats.cc_session.rpc_call = __check_rpc_call
         self.stats.cc_session.rpc_call = __check_rpc_call
 
 
         self.stats.update_modules()
         self.stats.update_modules()
@@ -477,7 +477,7 @@ class TestStats(unittest.TestCase):
         where we set the expected data in statistics_data.
         where we set the expected data in statistics_data.
 
 
         """
         """
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         def __faked_update_modules():
         def __faked_update_modules():
             self.stats.statistics_data = { \
             self.stats.statistics_data = { \
                 'Stats': {
                 'Stats': {
@@ -536,7 +536,7 @@ class TestStats(unittest.TestCase):
 
 
     def test_update_statistics_data(self):
     def test_update_statistics_data(self):
         """test for list-type statistics"""
         """test for list-type statistics"""
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         _test_exp1 = {
         _test_exp1 = {
               'zonename': 'test1.example',
               'zonename': 'test1.example',
               'queries.tcp': 5,
               'queries.tcp': 5,
@@ -613,7 +613,7 @@ class TestStats(unittest.TestCase):
 
 
     def test_update_statistics_data_pt2(self):
     def test_update_statistics_data_pt2(self):
         """test for named_set-type statistics"""
         """test for named_set-type statistics"""
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         _test_exp1 = \
         _test_exp1 = \
             { 'test10.example': { 'queries.tcp': 5, 'queries.udp': 4 } }
             { 'test10.example': { 'queries.tcp': 5, 'queries.udp': 4 } }
         _test_exp2 = \
         _test_exp2 = \
@@ -683,7 +683,7 @@ class TestStats(unittest.TestCase):
                 'Foo', 'foo1', _test_exp6), ['unknown module name: Foo'])
                 'Foo', 'foo1', _test_exp6), ['unknown module name: Foo'])
 
 
     def test_update_statistics_data_withmid(self):
     def test_update_statistics_data_withmid(self):
-        self.stats = SimpleStats()
+        self.stats = MyStats()
 
 
         # This test relies on existing statistics data at the Stats object.
         # This test relies on existing statistics data at the Stats object.
         # This version of test prepares the data using the do_polling() method;
         # This version of test prepares the data using the do_polling() method;
@@ -789,7 +789,7 @@ class TestStats(unittest.TestCase):
     def test_config(self):
     def test_config(self):
         orig_get_timestamp = stats.get_timestamp
         orig_get_timestamp = stats.get_timestamp
         stats.get_timestamp = lambda : self.const_timestamp
         stats.get_timestamp = lambda : self.const_timestamp
-        stat = SimpleStats()
+        stat = MyStats()
 
 
         # test updating poll-interval
         # test updating poll-interval
         self.assertEqual(stat.config['poll-interval'], 60)
         self.assertEqual(stat.config['poll-interval'], 60)
@@ -835,7 +835,7 @@ class TestStats(unittest.TestCase):
             (0, {'Init': {'boot_time': self.const_datetime}}))
             (0, {'Init': {'boot_time': self.const_datetime}}))
 
 
     def test_commands(self):
     def test_commands(self):
-        self.stats = SimpleStats()
+        self.stats = MyStats()
 
 
         # status
         # status
         self.assertEqual(self.stats.command_status(),
         self.assertEqual(self.stats.command_status(),
@@ -849,7 +849,7 @@ class TestStats(unittest.TestCase):
         self.assertFalse(self.stats.running)
         self.assertFalse(self.stats.running)
 
 
     def test_command_show_error(self):
     def test_command_show_error(self):
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         self.assertEqual(self.stats.command_show(owner='Foo', name=None),
         self.assertEqual(self.stats.command_show(owner='Foo', name=None),
                          isc.config.create_answer(
                          isc.config.create_answer(
                 1,
                 1,
@@ -864,7 +864,7 @@ class TestStats(unittest.TestCase):
                 "specified arguments are incorrect: owner: Foo, name: bar"))
                 "specified arguments are incorrect: owner: Foo, name: bar"))
 
 
     def test_command_show_auth(self):
     def test_command_show_auth(self):
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         self.stats.update_modules = lambda: None
         self.stats.update_modules = lambda: None
 
 
         # Test data borrowed from test_update_statistics_data_withmid
         # Test data borrowed from test_update_statistics_data_withmid
@@ -941,7 +941,7 @@ class TestStats(unittest.TestCase):
                                 'queries.tcp': sum_qtcp_nds_perzone20 }}}}))
                                 'queries.tcp': sum_qtcp_nds_perzone20 }}}}))
 
 
     def test_command_show_stats(self):
     def test_command_show_stats(self):
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         orig_get_datetime = stats.get_datetime
         orig_get_datetime = stats.get_datetime
         orig_get_timestamp = stats.get_timestamp
         orig_get_timestamp = stats.get_timestamp
         stats.get_datetime = lambda x=None: self.const_datetime
         stats.get_datetime = lambda x=None: self.const_datetime
@@ -965,7 +965,7 @@ class TestStats(unittest.TestCase):
             owner=self.stats.module_name, name='bar')
             owner=self.stats.module_name, name='bar')
 
 
     def test_command_showchema(self):
     def test_command_showchema(self):
-        self.stats = SimpleStats()
+        self.stats = MyStats()
         (rcode, value) = isc.config.ccsession.parse_answer(
         (rcode, value) = isc.config.ccsession.parse_answer(
             self.stats.command_showschema())
             self.stats.command_showschema())
         self.assertEqual(rcode, 0)
         self.assertEqual(rcode, 0)
@@ -1284,7 +1284,7 @@ class TestStats(unittest.TestCase):
     def test_polling_init(self):
     def test_polling_init(self):
         """check statistics data of 'Init'."""
         """check statistics data of 'Init'."""
 
 
-        stat = SimpleStats()
+        stat = MyStats()
         stat.update_modules = lambda: None
         stat.update_modules = lambda: None
         create_answer = isc.config.ccsession.create_answer # shortcut
         create_answer = isc.config.ccsession.create_answer # shortcut
 
 
@@ -1303,7 +1303,7 @@ class TestStats(unittest.TestCase):
 
 
     def test_polling_consolidate(self):
     def test_polling_consolidate(self):
         """check statistics data of multiple instances of same module."""
         """check statistics data of multiple instances of same module."""
-        stat = SimpleStats()
+        stat = MyStats()
         stat.update_modules = lambda: None
         stat.update_modules = lambda: None
         create_answer = isc.config.ccsession.create_answer # shortcut
         create_answer = isc.config.ccsession.create_answer # shortcut
 
 
@@ -1362,7 +1362,7 @@ class TestStats(unittest.TestCase):
         compatibility of older tests.
         compatibility of older tests.
 
 
         """
         """
-        stat = SimpleStats()
+        stat = MyStats()
         self.assertEqual(len(stat.statistics_data['Stats']), 5)
         self.assertEqual(len(stat.statistics_data['Stats']), 5)
         self.assertTrue('boot_time' in stat.statistics_data['Stats'])
         self.assertTrue('boot_time' in stat.statistics_data['Stats'])
         self.assertTrue('last_update_time' in stat.statistics_data['Stats'])
         self.assertTrue('last_update_time' in stat.statistics_data['Stats'])
@@ -1378,7 +1378,7 @@ class TestStats(unittest.TestCase):
         fixing that is a subject of different ticket.
         fixing that is a subject of different ticket.
 
 
         """
         """
-        stat = SimpleStats()
+        stat = MyStats()
         # check default statistics data of 'Init'
         # check default statistics data of 'Init'
         self.assertEqual(
         self.assertEqual(
              stat.statistics_data['Init'],
              stat.statistics_data['Init'],

+ 2 - 2
src/bin/stats/tests/test_utils.py

@@ -317,7 +317,7 @@ class MyModuleCCSession(isc.config.ConfigData):
     def close(self):
     def close(self):
         self.closed = True
         self.closed = True
 
 
-class SimpleStats(stats.Stats):
+class MyStats(stats.Stats):
     """A faked Stats class for unit tests.
     """A faked Stats class for unit tests.
 
 
     This class inherits most of the real Stats class, but replaces the
     This class inherits most of the real Stats class, but replaces the
@@ -430,7 +430,7 @@ class SimpleStats(stats.Stats):
         answer, _ = self.__group_recvmsg(None, None)
         answer, _ = self.__group_recvmsg(None, None)
         return isc.config.ccsession.parse_answer(answer)[1]
         return isc.config.ccsession.parse_answer(answer)[1]
 
 
-class SimpleStatsHttpd(stats_httpd.StatsHttpd):
+class MyStatsHttpd(stats_httpd.StatsHttpd):
     """A faked StatsHttpd class for unit tests.
     """A faked StatsHttpd class for unit tests.
 
 
     This class inherits most of the real StatsHttpd class, but replaces the
     This class inherits most of the real StatsHttpd class, but replaces the