Exemplo n.º 1
0
 def test_restart(self):
     mock = MagicMock(return_value=0)
     with patch.dict(debian_service.__salt__, {"cmd.retcode": mock}):
         # Test successful command (0 retcode)
         assert debian_service.restart("foo")
         # Confirm expected command was run
         mock.assert_called_once_with("service foo restart")
         # Test unsuccessful command (nonzero retcode)
         mock.return_value = 1
         assert not debian_service.restart("foo")
Exemplo n.º 2
0
 def test_restart(self):
     '''
     Test for Restart the named 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.restart('name'))
 def test_restart(self):
     """
     Test for Restart the named 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.restart("name"))
Exemplo n.º 4
0
 def test_restart(self):
     '''
     Test for Restart the named 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.restart('name'))