mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Create JobIncompleteError
This commit is contained in:
@@ -9,7 +9,7 @@ def app_for_test(mocker):
|
||||
import flask
|
||||
from flask import Blueprint
|
||||
from app.authentication.auth import AuthError
|
||||
from app.v2.errors import BadRequestError, TooManyRequestsError
|
||||
from app.v2.errors import BadRequestError, TooManyRequestsError, JobIncompleteError
|
||||
|
||||
app = flask.Flask(__name__)
|
||||
app.config['TESTING'] = True
|
||||
@@ -39,6 +39,10 @@ def app_for_test(mocker):
|
||||
def raising_data_error():
|
||||
raise DataError("There was a db problem", "params", "orig")
|
||||
|
||||
@blue.route("raise_job_incomplete_error", methods=["GET"])
|
||||
def raising_job_incomplete_error():
|
||||
raise JobIncompleteError("Raising job incomplete error")
|
||||
|
||||
@blue.route("raise_exception", methods=["GET"])
|
||||
def raising_exception():
|
||||
raise AssertionError("Raising any old exception")
|
||||
@@ -107,6 +111,16 @@ def test_data_errors(app_for_test):
|
||||
"errors": [{"error": "DataError", "message": "No result found"}]}
|
||||
|
||||
|
||||
def test_job_incomplete_errors(app_for_test):
|
||||
with app_for_test.test_request_context():
|
||||
with app_for_test.test_client() as client:
|
||||
response = client.get(url_for('v2_under_test.raising_job_incomplete_error'))
|
||||
assert response.status_code == 500
|
||||
error = json.loads(response.get_data(as_text=True))
|
||||
assert error == {"status_code": 500,
|
||||
"errors": [{"error": "JobIncompleteError", "message": "Raising job incomplete error"}]}
|
||||
|
||||
|
||||
def test_internal_server_error_handler(app_for_test):
|
||||
with app_for_test.test_request_context():
|
||||
with app_for_test.test_client() as client:
|
||||
|
||||
Reference in New Issue
Block a user