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()
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')
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')
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)
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)
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()