コード例 #1
0
 def test_disable(self):
     mock = MagicMock(return_value=0)
     with patch.dict(debian_service.__salt__, {"cmd.retcode": mock}):
         # Test successful command (0 retcode)
         assert debian_service.disable("foo")
         # Confirm expected command was run
         mock.assert_called_once_with("update-rc.d foo disable")
         # Test unsuccessful command (nonzero retcode)
         mock.return_value = 1
         assert not debian_service.disable("foo")
コード例 #2
0
 def test_disable(self):
     '''
     Test for Disable the named service to start at boot
     '''
     mock = MagicMock(return_value='5')
     with patch.object(debian_service, '_osrel', mock):
         mock = MagicMock(return_value=True)
         with patch.dict(debian_service.__salt__, {'cmd.retcode': mock}):
             self.assertFalse(debian_service.disable('name'))
コード例 #3
0
 def test_disable(self):
     """
     Test for Disable the named service to start at boot
     """
     mock = MagicMock(return_value="5")
     with patch.object(debian_service, "_osrel", mock):
         mock = MagicMock(return_value=True)
         with patch.dict(debian_service.__salt__, {"cmd.retcode": mock}):
             self.assertFalse(debian_service.disable("name"))
コード例 #4
0
ファイル: debian_service_test.py プロジェクト: DaveQB/salt
 def test_disable(self):
     '''
     Test for Disable the named service to start at boot
     '''
     mock = MagicMock(return_value='5')
     with patch.object(debian_service, '_osrel', mock):
         mock = MagicMock(return_value=True)
         with patch.dict(debian_service.__salt__, {'cmd.retcode': mock}):
             self.assertFalse(debian_service.disable('name'))