assertEquals -> assertEqual

This commit is contained in:
nilez 2021-08-16 10:25:41 -04:00
commit 0a232dace6
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,5 @@
import json
from SpiffWorkflow import WorkflowException
from SpiffWorkflow.exceptions import WorkflowTaskExecException
from flask import g
@ -88,6 +90,15 @@ class ApiErrorSchema(ma.Schema):
@app.errorhandler(ApiError)
def handle_invalid_usage(error):
response = ApiErrorSchema().dump(error)
# In the unlikely event that the API error can't be serialized, try removing the task_data, as it may
# contain some invalid data that we can't return, so we can at least get the erro rmessage.
try:
json_output = json.dumps(response)
except TypeError as te:
error.task_data = {'task_data_hidden':'We were unable to serialize the task data when reporting this error'}
response = ApiErrorSchema().dump(error)
return response, error.status_code

View File

@ -1,3 +1,4 @@
from SpiffWorkflow.bpmn.PythonScriptEngine import Box
from tests.base_test import BaseTest
@ -134,6 +135,7 @@ class TestStudyDetailsDocumentsScript(BaseTest):
self.assertEqual(1, len(docs.Study_App_Doc.files))
self.assertEqual("Study_App_Doc", docs.Study_App_Doc.files[0].data_store.irb_code)
@patch('crc.services.protocol_builder.requests.get')
def test_file_data_set_invalid_irb_code_fails(self, mock_get):
mock_get.return_value.ok = True