def test_server_status(self): ''' Test if return get information from the Apache server-status ''' mock = MagicMock(return_value='') with patch.dict(apache.__salt__, {'config.get': mock}): self.assertEqual(apache.server_status(), {})
def test_server_status(self): """ Test if return get information from the Apache server-status """ with patch("salt.modules.apache.server_status", MagicMock(return_value={})): mock = MagicMock(return_value="") with patch.dict(apache.__salt__, {"config.get": mock}): assert apache.server_status() == {}
def test_server_status_error(self): ''' Test if return get error from the Apache server-status ''' mock = MagicMock(side_effect=URLError('error')) with patch.object(apache, '_urlopen', mock): mock = MagicMock(return_value='') with patch.dict(apache.__salt__, {'config.get': mock}): self.assertEqual(apache.server_status(), 'error')
def test_server_status_error(self): """ Test if return get error from the Apache server-status """ mock = MagicMock(side_effect=urllib.error.URLError("error")) with patch("urllib.request.urlopen", mock): mock = MagicMock(return_value="") with patch.dict(apache.__salt__, {"config.get": mock}): assert apache.server_status() == "error"
def test_server_status(self): ''' Test if return get information from the Apache server-status ''' with patch('salt.modules.apache.server_status', MagicMock(return_value={})): mock = MagicMock(return_value='') with patch.dict(apache.__salt__, {'config.get': mock}): assert apache.server_status() == {}