From: JINMEI Tatuya Date: Tue, 30 Apr 2013 00:48:51 +0000 (-0700) Subject: [2823] updated openclose_mccs test for stats httpd using the new mock class X-Git-Tag: bind10-1.2.0beta1-release~474^2~2^2~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2aaa162fd5f5921aac58baeeb0dd026b7a0a2fbb;p=thirdparty%2Fkea.git [2823] updated openclose_mccs test for stats httpd using the new mock class --- diff --git a/src/bin/stats/tests/b10-stats-httpd_test.py b/src/bin/stats/tests/b10-stats-httpd_test.py index 938dd8097b..0329341011 100644 --- a/src/bin/stats/tests/b10-stats-httpd_test.py +++ b/src/bin/stats/tests/b10-stats-httpd_test.py @@ -644,11 +644,9 @@ class TestStatsHttpd(unittest.TestCase): self.assertRaises(stats_httpd.HttpServerError, SimpleStatsHttpd) stats_httpd.StatsHttpd.open_httpd = orig_open_httpd - @unittest.skipIf(True, 'tentatively skipped') def test_openclose_mccs(self): - self.stats_httpd = MyStatsHttpd(get_availaddr()) - mccs = MockModuleCCSession() - self.stats_httpd.mccs = mccs + self.stats_httpd = SimpleStatsHttpd(get_availaddr()) + mccs = self.stats_httpd.mccs self.assertFalse(self.stats_httpd.mccs.stopped) self.assertFalse(self.stats_httpd.mccs.closed) self.stats_httpd.close_mccs() diff --git a/src/bin/stats/tests/test_utils.py b/src/bin/stats/tests/test_utils.py index 27324b3d68..ed54ca14dc 100644 --- a/src/bin/stats/tests/test_utils.py +++ b/src/bin/stats/tests/test_utils.py @@ -469,6 +469,7 @@ class MyModuleCCSession(isc.config.ConfigData): isc.config.ConfigData.__init__(self, module_spec) self._session = self self.stopped = False + self.closed = False self.lname = 'mock_mod_ccs' def start(self): @@ -477,6 +478,9 @@ class MyModuleCCSession(isc.config.ConfigData): def send_stopping(self): self.stopped = True # just record it's called to inspect it later + def close(self): + self.closed = True + class SimpleStats(stats.Stats): """A faked Stats class for unit tests. @@ -668,9 +672,11 @@ class SimpleStatsHttpd(stats_httpd.StatsHttpd): self.mccs.start = self.load_config # force reload def close_mccs(self): + super().close_mccs() if self.__dummy_socks is not None: self.__dummy_socks[0].close() self.__dummy_socks[1].close() + self.__dummy_socks = None def __rpc_call(self, command, group, params={}): """Faked ModuleCCSession.rpc_call for tests.