From: JINMEI Tatuya Date: Tue, 19 Feb 2013 19:34:14 +0000 (-0800) Subject: [2689] eliminate threads from get_statistics_data() test. X-Git-Tag: bind10-1.1.0beta1-release~76^2~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ba7df48ebcf5759d87e4e487aca9deb35799b1b;p=thirdparty%2Fkea.git [2689] eliminate threads from get_statistics_data() test. --- diff --git a/src/bin/stats/tests/b10-stats_test.py b/src/bin/stats/tests/b10-stats_test.py index bc8aae4aaf..bdbed9f598 100644 --- a/src/bin/stats/tests/b10-stats_test.py +++ b/src/bin/stats/tests/b10-stats_test.py @@ -490,7 +490,28 @@ class TestStats(unittest.TestCase): stats.isc.config.ccsession.parse_answer = orig_parse_answer def test_get_statistics_data(self): - self.stats = stats.Stats() + """Confirm the behavior of Stats.get_statistics_data(). + + It should first call update_modules(), and then retrieve the requested + data from statistics_data. We confirm this by fake update_modules() + where we set the expected data in statistics_data. + + """ + self.stats = self.SimpleStat() + def __faked_update_modules(): + self.stats.statistics_data = { \ + 'Stats': { + 'report_time': self.const_default_datetime, + 'boot_time': None, + 'last_update_time': None, + 'timestamp': 0.0, + 'lname': 'dummy name' + }, + 'Init': { 'boot_time': None } + } + + self.stats.update_modules = __faked_update_modules + my_statistics_data = self.stats.get_statistics_data() self.assertTrue('Stats' in my_statistics_data) self.assertTrue('Init' in my_statistics_data)