]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2689] eliminate threads from get_statistics_data() test.
authorJINMEI Tatuya <jinmei@isc.org>
Tue, 19 Feb 2013 19:34:14 +0000 (11:34 -0800)
committerJINMEI Tatuya <jinmei@isc.org>
Tue, 19 Feb 2013 19:34:14 +0000 (11:34 -0800)
src/bin/stats/tests/b10-stats_test.py

index bc8aae4aafdeadbc0181ac74786813c0331c6b30..bdbed9f598e1de895d7f2a2ee84e15e9b0883dfc 100644 (file)
@@ -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)