コード例 #1
0
ファイル: system_test.py プロジェクト: DaveQB/salt
 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')
コード例 #2
0
ファイル: test_system.py プロジェクト: vindir/salt
 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')
コード例 #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)
コード例 #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)