def test_disable(self): ''' Test if it disable the named service to start at boot. ''' mock_bool = MagicMock(side_effect=[True, False]) with patch.object(rh_service, '_service_is_upstart', mock_bool): global HAS_UPSTART HAS_UPSTART = True self.assertFalse(rh_service.disable('salt-api')) with patch.object(rh_service, '_sysv_disable', self._m_bool()): self.assertTrue(rh_service.disable('salt-api'))
def test_disable(self): ''' Test if it disable the named service to start at boot. ''' mock_bool = MagicMock(side_effect=[True, True, False]) with patch.object(rh_service, '_service_is_upstart', mock_bool): with patch.object(rh_service, '_upstart_is_enabled', MagicMock(return_value=True)): with patch.object(rh_service, '_upstart_disable', MagicMock(return_value=False)): self.assertFalse(rh_service.disable('salt-api')) with patch.object(rh_service, '_upstart_disable', MagicMock(return_value=True)): self.assertTrue(rh_service.disable('salt-api')) with patch.object(rh_service, '_sysv_disable', self._m_bool()): self.assertTrue(rh_service.disable('salt-api'))
def test_disable(self): """ Test if it disable the named service to start at boot. """ mock_bool = MagicMock(side_effect=[True, True, False]) with patch.object(rh_service, "_service_is_upstart", mock_bool): with patch.object(rh_service, "_upstart_is_enabled", MagicMock(return_value=True)): with patch.object(rh_service, "_upstart_disable", MagicMock(return_value=False)): self.assertFalse(rh_service.disable("salt-api")) with patch.object(rh_service, "_upstart_disable", MagicMock(return_value=True)): self.assertTrue(rh_service.disable("salt-api")) with patch.object(rh_service, "_sysv_disable", self._m_bool()): self.assertTrue(rh_service.disable("salt-api"))