def test_enable(self): ''' Test if it enable 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.enable('salt-api')) with patch.object(rh_service, '_sysv_enable', self._m_bool()): self.assertTrue(rh_service.enable('salt-api'))
def test_enable(self): ''' Test if it enable 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_enable', MagicMock(return_value=False)): self.assertFalse(rh_service.enable('salt-api')) with patch.object(rh_service, '_upstart_enable', MagicMock(return_value=True)): self.assertTrue(rh_service.enable('salt-api')) with patch.object(rh_service, '_sysv_enable', self._m_bool()): self.assertTrue(rh_service.enable('salt-api'))
def test_enable(self): """ Test if it enable 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_enable", MagicMock(return_value=False)): self.assertFalse(rh_service.enable("salt-api")) with patch.object(rh_service, "_upstart_enable", MagicMock(return_value=True)): self.assertTrue(rh_service.enable("salt-api")) with patch.object(rh_service, "_sysv_enable", self._m_bool()): self.assertTrue(rh_service.enable("salt-api"))