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