Ejemplo n.º 1
0
 def test_shutdown(self):
     '''
     Test to shutdown a running system
     '''
     with patch.dict(system.__salt__,
                     {'cmd.run': MagicMock(return_value='A')}):
         self.assertEqual(system.shutdown(), 'A')
Ejemplo n.º 2
0
 def test_shutdown(self):
     '''
     Test to shutdown a running system
     '''
     with patch.dict(system.__salt__,
                     {'cmd.run': MagicMock(return_value='A')}):
         self.assertEqual(system.shutdown(), 'A')
Ejemplo n.º 3
0
 def test_shutdown_openbsd(self):
     """
     Test to shutdown a running OpenBSD system
     """
     cmd_mock = MagicMock(return_value="A")
     with patch.dict(system.__salt__, {"cmd.run": cmd_mock}), patch(
         "salt.utils.platform.is_freebsd", MagicMock(return_value=False)
     ), patch("salt.utils.platform.is_netbsd", MagicMock(return_value=False)), patch(
         "salt.utils.platform.is_openbsd", MagicMock(return_value=True)
     ):
         self.assertEqual(system.shutdown(), "A")
     cmd_mock.assert_called_with(["shutdown", "-p", "now"], python_shell=False)
Ejemplo n.º 4
0
 def test_shutdown_netbsd(self):
     '''
     Test to shutdown a running NetBSD system
     '''
     cmd_mock = MagicMock(return_value='A')
     with patch.dict(system.__salt__, {'cmd.run': cmd_mock}), \
             patch('salt.utils.platform.is_freebsd', MagicMock(return_value=False)), \
             patch('salt.utils.platform.is_netbsd', MagicMock(return_value=True)), \
             patch('salt.utils.platform.is_openbsd', MagicMock(return_value=False)):
         self.assertEqual(system.shutdown(), 'A')
     cmd_mock.assert_called_with(['shutdown', '-p', 'now'],
                                 python_shell=False)