예제 #1
0
 def testRebootValidate(self):
     r = system.Reboot(30, None)
     self.assertRaises(system.ValidationError, r.Validate)
     r = system.Reboot([], None)
     self.assertRaises(system.ValidationError, r.Validate)
     r = system.Reboot([30, 40], None)
     self.assertRaises(system.ValidationError, r.Validate)
     r = system.Reboot([30, 'reasons'], None)
     r.Validate()
예제 #2
0
    def testReboot(self, build_info):
        r = system.Reboot([30, 'reboot for reasons'], build_info)
        with self.assertRaises(system.RestartEvent) as evt:
            r.Run()
            self.assertEqual(evt.timeout, '30')
            self.assertEqual(evt.message, 'reboot for reasons')

        r = system.Reboot([10], build_info)
        with self.assertRaises(system.RestartEvent) as evt:
            r.Run()
            self.assertEqual(evt.timeout, '10')
            self.assertEqual(evt.message, 'undefined')
예제 #3
0
    def testReboot(self, build_info):
        r = system.Reboot([30, 'reboot for reasons'], build_info)
        with self.assertRaises(system.RestartEvent) as evt:
            r.Run()
        ex = evt.exception
        self.assertEqual(ex.timeout, '30')
        self.assertEqual(str(ex), 'reboot for reasons')

        r = system.Reboot([10], build_info)
        with self.assertRaises(system.RestartEvent) as evt:
            r.Run()
        ex = evt.exception
        self.assertEqual(ex.timeout, '10')
        self.assertEqual(str(ex), 'unspecified')
예제 #4
0
 def testRebootTimeout(self, build_info):
     r = system.Reboot([10], build_info)
     with self.assertRaises(system.RestartEvent) as evt:
         r.Run()
     ex = evt.exception
     self.assertEqual(ex.timeout, '10')
     self.assertEqual(str(ex), 'unspecified')
     self.assertEqual(ex.pop_next, False)
예제 #5
0
 def testRebootReason(self, build_info):
     r = system.Reboot([30, 'reboot for reasons'], build_info)
     with self.assertRaises(system.RestartEvent) as evt:
         r.Run()
     ex = evt.exception
     self.assertEqual(ex.timeout, '30')
     self.assertEqual(str(ex), 'reboot for reasons')
     self.assertEqual(ex.pop_next, False)
예제 #6
0
 def testRebootValidate(self):
     r = system.Reboot(True, None)
     self.assertRaises(system.ValidationError, r.Validate)
     r = system.Reboot([30, 40], None)
     self.assertRaises(system.ValidationError, r.Validate)
     r = system.Reboot([30, 'reasons', 'True'], None)
     self.assertRaises(system.ValidationError, r.Validate)
     r = system.Reboot([1, 2, 3, 4], None)
     self.assertRaises(system.ValidationError, r.Validate)
     r = system.Reboot([30, 'reasons', True], None)
     r.Validate()
     r = system.Reboot([30, 'reasons'], None)
     r.Validate()
     r = system.Reboot([30], None)
     r.Validate()