Beispiel #1
0
 def test_reboot(self):
     '''
         Test to reboot the system
     '''
     mock = MagicMock(return_value='salt')
     with patch.dict(win_system.__salt__, {'cmd.run': mock}):
         self.assertEqual(win_system.reboot(), 'salt')
Beispiel #2
0
 def test_reboot(self):
     '''
         Test to reboot the system
     '''
     with patch('salt.modules.win_system.shutdown',
                MagicMock(return_value=True)) as shutdown:
         self.assertEqual(win_system.reboot(), True)
Beispiel #3
0
 def test_reboot(self):
     """
     Test to reboot the system
     """
     with patch("salt.modules.win_system.shutdown",
                MagicMock(return_value=True)):
         self.assertEqual(win_system.reboot(), True)
Beispiel #4
0
 def test_reboot(self):
     '''
         Test to reboot the system
     '''
     mock = MagicMock(return_value='salt')
     with patch.dict(win_system.__salt__, {'cmd.run': mock}):
         self.assertEqual(win_system.reboot(), 'salt')
Beispiel #5
0
 def test_reboot_with_timeout_in_seconds(self):
     '''
         Test to reboot the system with a timeout
     '''
     mock = MagicMock(return_value='salt')
     with patch.dict(win_system.__salt__, {'cmd.run': mock}):
         self.assertEqual(win_system.reboot(5, in_seconds=True), 'salt')
         mock.assert_called_once_with(['shutdown', '/r', '/t', '5'], python_shell=False)
Beispiel #6
0
 def test_reboot(self):
     '''
         Test to reboot the system
     '''
     mock = MagicMock(return_value='salt')
     with patch.dict(win_system.__salt__, {'cmd.run': mock}):
         self.assertEqual(win_system.reboot(), 'salt')
         mock.assert_called_once_with(['shutdown', '/r', '/t', '300'], python_shell=False)
Beispiel #7
0
 def test_reboot_with_timeout_in_seconds(self):
     '''
         Test to reboot the system with a timeout
     '''
     mock = MagicMock(return_value='salt')
     with patch.dict(win_system.__salt__, {'cmd.run': mock}):
         self.assertEqual(win_system.reboot(5, in_seconds=True), 'salt')
         mock.assert_called_once_with(['shutdown', '/r', '/t', '5'], python_shell=False)
Beispiel #8
0
 def test_reboot(self):
     '''
         Test to reboot the system
     '''
     mock = MagicMock(return_value='salt')
     with patch.dict(win_system.__salt__, {'cmd.run': mock}):
         self.assertEqual(win_system.reboot(), 'salt')
         mock.assert_called_once_with(['shutdown', '/r', '/t', '300'], python_shell=False)
Beispiel #9
0
 def test_reboot_with_timeout_in_seconds(self):
     '''
         Test to reboot the system with a timeout
     '''
     with patch('salt.modules.win_system.shutdown',
                MagicMock(return_value=True)) as shutdown:
         self.assertEqual(win_system.reboot(5, in_seconds=True), True)
         shutdown.assert_called_with(timeout=5, in_seconds=True, reboot=True,
                                     only_on_pending_reboot=False)
Beispiel #10
0
 def test_reboot_with_wait(self):
     """
         Test to reboot the system with a timeout and
         wait for it to finish
     """
     with patch(
         "salt.modules.win_system.shutdown", MagicMock(return_value=True)
     ), patch("salt.modules.win_system.time.sleep", MagicMock()) as time:
         self.assertEqual(win_system.reboot(wait_for_reboot=True), True)
         time.assert_called_with(330)
Beispiel #11
0
 def test_reboot_with_wait(self):
     '''
         Test to reboot the system with a timeout and
         wait for it to finish
     '''
     mock = MagicMock(return_value='salt')
     sleep_mock = MagicMock(return_value='salt')
     with patch.dict(win_system.__salt__, {'cmd.run': mock}):
         with patch('time.sleep', sleep_mock):
             self.assertEqual(win_system.reboot(wait_for_reboot=True), 'salt')
             mock.assert_called_once_with(['shutdown', '/r', '/t', '300'], python_shell=False)
             sleep_mock.assert_called_once_with(330)
Beispiel #12
0
 def test_reboot_with_wait(self):
     '''
         Test to reboot the system with a timeout and
         wait for it to finish
     '''
     mock = MagicMock(return_value='salt')
     sleep_mock = MagicMock(return_value='salt')
     with patch.dict(win_system.__salt__, {'cmd.run': mock}):
         with patch('time.sleep', sleep_mock):
             self.assertEqual(win_system.reboot(wait_for_reboot=True), 'salt')
             mock.assert_called_once_with(['shutdown', '/r', '/t', '300'], python_shell=False)
             sleep_mock.assert_called_once_with(330)