예제 #1
0
 def testBootTimeNonExistantFile(self):
     with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH',
                             '/i/do/not/exist/1234567890')]):
         with self.assertRaises(IOError):
             hoststats.get_boot_time()
예제 #2
0
 def testBootTimeEmpty(self):
     with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH', '/dev/null')]):
         with self.assertRaises(ValueError):
             hoststats.get_boot_time()
예제 #3
0
 def testBootTimeMalformed(self):
     with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH',
                             self._malformed_path)]):
         with self.assertRaises(ValueError):
             hoststats.get_boot_time()
예제 #4
0
 def testBootTimeOk(self):
     with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH', self._good_path)
                            ]):
         self.assertEqual(hoststats.get_boot_time(), 1395249141)
예제 #5
0
 def testBootTimeNonExistantFile(self):
     with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH',
                             '/i/do/not/exist/1234567890')]):
         with self.assertRaises(IOError):
             hoststats.get_boot_time()
예제 #6
0
 def testBootTimeMalformed(self):
     with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH',
                             self._malformed_path)]):
         with self.assertRaises(ValueError):
             hoststats.get_boot_time()
예제 #7
0
 def testBootTimeEmpty(self):
     with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH',
                             '/dev/null')]):
         with self.assertRaises(ValueError):
             hoststats.get_boot_time()
예제 #8
0
 def testBootTimeOk(self):
     with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH',
                             self._good_path)]):
         self.assertEquals(hoststats.get_boot_time(),
                           1395249141)