From: JINMEI Tatuya Date: Mon, 6 May 2013 23:22:21 +0000 (-0700) Subject: [2823] updated test_init_hterr so it also checks close_mccs is called. X-Git-Tag: bind10-1.2.0beta1-release~474^2~2^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7ccddd64de7f7928d20f7eff23053b64c644349d;p=thirdparty%2Fkea.git [2823] updated test_init_hterr so it also checks close_mccs is called. --- diff --git a/src/bin/stats/tests/stats-httpd_test.py b/src/bin/stats/tests/stats-httpd_test.py index bf338955b2..37ea7e3cf0 100644 --- a/src/bin/stats/tests/stats-httpd_test.py +++ b/src/bin/stats/tests/stats-httpd_test.py @@ -642,10 +642,24 @@ class TestStatsHttpd(unittest.TestCase): get_module_spec().get_module_name()) def test_init_hterr(self): + """Test the behavior of StatsHttpd constructor when open_httpd fails. + + We specifically check the following two: + - close_mccs() is called (so stats-httpd tells ConfigMgr it's shutting + down) + - the constructor results in HttpServerError exception. + + """ + self.__mccs_closed = False + def __call_checker(): + self.__mccs_closed = True class FailingStatsHttpd(MyStatsHttpd): def open_httpd(self): raise stats_httpd.HttpServerError + def close_mccs(self): + __call_checker() self.assertRaises(stats_httpd.HttpServerError, FailingStatsHttpd) + self.assertTrue(self.__mccs_closed) def test_openclose_mccs(self): self.stats_httpd = MyStatsHttpd(get_availaddr())