Remove 204-NoContent, Flask, and Werkzeug no longer provide
public apis to add additional error code exception handling.
This commit is contained in:
@@ -16,12 +16,6 @@ def mock_puppetdb_environments(mocker):
|
||||
return_value=environemnts)
|
||||
|
||||
|
||||
def test_error_no_content():
|
||||
result = app.no_content(None)
|
||||
assert result[0] == ''
|
||||
assert result[1] == 204
|
||||
|
||||
|
||||
def test_error_bad_request(mock_puppetdb_environments):
|
||||
with app.app.test_request_context():
|
||||
(output, error_code) = app.bad_request(None)
|
||||
|
||||
@@ -12,7 +12,6 @@ from werkzeug.exceptions import NotFound, InternalServerError
|
||||
|
||||
from puppetboard import utils
|
||||
from puppetboard import app
|
||||
from puppetboard.app import NoContent
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
import logging
|
||||
@@ -108,19 +107,6 @@ def test_http_connection_error(mock_log):
|
||||
mock_log.error.assert_called_with(err)
|
||||
|
||||
|
||||
def test_http_empty(mock_log, mocker):
|
||||
err = "Empty Response"
|
||||
|
||||
def connection_error():
|
||||
raise EmptyResponseError(err)
|
||||
|
||||
flask_abort = mocker.patch('flask.abort')
|
||||
with pytest.raises(NoContent):
|
||||
utils.get_or_abort(connection_error)
|
||||
mock_log.error.assert_called_with(err)
|
||||
flask_abort.assert_called_with('204')
|
||||
|
||||
|
||||
def test_db_version_good(mocker, mock_info_log):
|
||||
mocker.patch.object(app.puppetdb, 'current_version', return_value='4.2.0')
|
||||
err = 'PuppetDB Version %d.%d.%d' % (4, 2, 0)
|
||||
|
||||
Reference in New Issue
Block a user