Example #1
0
 def test_stop(self):
     mock = MagicMock(return_value=0)
     with patch.dict(debian_service.__salt__, {"cmd.retcode": mock}):
         # Test successful command (0 retcode)
         assert debian_service.stop("foo")
         # Confirm expected command was run
         mock.assert_called_once_with("service foo stop")
         # Test unsuccessful command (nonzero retcode)
         mock.return_value = 1
         assert not debian_service.stop("foo")
Example #2
0
 def test_stop(self):
     '''
     Test for Stop the specified service
     '''
     mock = MagicMock(return_value=True)
     with patch.object(debian_service, '_service_cmd', mock):
         with patch.dict(debian_service.__salt__, {'cmd.retcode': mock}):
             self.assertFalse(debian_service.stop('name'))
 def test_stop(self):
     """
     Test for Stop the specified service
     """
     mock = MagicMock(return_value=True)
     with patch.object(debian_service, "_service_cmd", mock):
         with patch.dict(debian_service.__salt__, {"cmd.retcode": mock}):
             self.assertFalse(debian_service.stop("name"))
Example #4
0
 def test_stop(self):
     '''
     Test for Stop the specified service
     '''
     mock = MagicMock(return_value=True)
     with patch.object(debian_service, '_service_cmd', mock):
         with patch.dict(debian_service.__salt__, {'cmd.retcode': mock}):
             self.assertFalse(debian_service.stop('name'))