fixing a bug in Spiff that was preventing our tests from passing.
This commit is contained in:
parent
b20ccf02ae
commit
65ffc37787
|
@ -1266,7 +1266,7 @@
|
||||||
},
|
},
|
||||||
"spiffworkflow": {
|
"spiffworkflow": {
|
||||||
"git": "https://github.com/sartography/SpiffWorkflow",
|
"git": "https://github.com/sartography/SpiffWorkflow",
|
||||||
"ref": "747b0a9cafeb2900264dbc5235c01c2386c55bd1"
|
"ref": "5c9301a3f47bd3dbeae72ffefd9d25cfee35fd0e"
|
||||||
},
|
},
|
||||||
"sqlalchemy": {
|
"sqlalchemy": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
|
|
|
@ -172,10 +172,9 @@ class WorkflowService(object):
|
||||||
"""Raise an exception of the workflow is not enabled and can not be executed."""
|
"""Raise an exception of the workflow is not enabled and can not be executed."""
|
||||||
if study_id is not None:
|
if study_id is not None:
|
||||||
study_model = session.query(StudyModel).filter(StudyModel.id == study_id).first()
|
study_model = session.query(StudyModel).filter(StudyModel.id == study_id).first()
|
||||||
spec_model = session.query(WorkflowSpecModel).filter(WorkflowSpecModel.id == spec_id).first()
|
|
||||||
status = StudyService._get_study_status(study_model)
|
status = StudyService._get_study_status(study_model)
|
||||||
if spec_model.id in status and status[spec_model.id]['status'] == 'disabled':
|
if spec_id in status and status[spec_id]['status'] == 'disabled':
|
||||||
raise ApiError(code='disabled_workflow', message=f"This workflow is disabled. {status[spec_model.id]['message']}")
|
raise ApiError(code='disabled_workflow', message=f"This workflow is disabled. {status[spec_id]['message']}")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@timeit
|
@timeit
|
||||||
|
@ -191,6 +190,7 @@ class WorkflowService(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
workflow_model = WorkflowService.make_test_workflow(spec_id, validate_study_id)
|
workflow_model = WorkflowService.make_test_workflow(spec_id, validate_study_id)
|
||||||
|
WorkflowService.raise_if_disabled(spec_id, validate_study_id)
|
||||||
try:
|
try:
|
||||||
processor = WorkflowProcessor(workflow_model, validate_only=True)
|
processor = WorkflowProcessor(workflow_model, validate_only=True)
|
||||||
count = 0
|
count = 0
|
||||||
|
|
|
@ -96,6 +96,14 @@ class TestWorkflowSpecValidation(BaseTest):
|
||||||
def test_invalid_script3(self):
|
def test_invalid_script3(self):
|
||||||
self.load_test_spec('empty_workflow', master_spec=True)
|
self.load_test_spec('empty_workflow', master_spec=True)
|
||||||
self.create_reference_document()
|
self.create_reference_document()
|
||||||
|
|
||||||
|
workflow = self.create_workflow('delete_variables')
|
||||||
|
workflow_api = self.get_workflow_api(workflow)
|
||||||
|
task = workflow_api.next_task
|
||||||
|
workflow_api = self.complete_form(workflow, task, {})
|
||||||
|
# for item in ('a', 'b', 'c', 'd', 'e'):
|
||||||
|
# self.assertIn(item, task.data)
|
||||||
|
|
||||||
errors = self.validate_workflow("invalid_script3")
|
errors = self.validate_workflow("invalid_script3")
|
||||||
self.assertEqual(1, len(errors))
|
self.assertEqual(1, len(errors))
|
||||||
self.assertEqual("Invalid_Script_Task", errors[0]['task_id'])
|
self.assertEqual("Invalid_Script_Task", errors[0]['task_id'])
|
||||||
|
|
Loading…
Reference in New Issue