diff --git a/crc/services/workflow_service.py b/crc/services/workflow_service.py index 96a1d6c0..a30622a2 100644 --- a/crc/services/workflow_service.py +++ b/crc/services/workflow_service.py @@ -127,6 +127,10 @@ class WorkflowService(object): form_data = task.data # Just like with the front end, we start with what was already there, and modify it. hide_groups = [] for field in task_api.form.fields: + # Assure we have a field type + if field.type is None: + raise ApiError(code='invalid_form_data', + message='Field type is None. A field type must be provided.') # Assure field has valid properties WorkflowService.check_field_properties(field, task) diff --git a/tests/data/invalid_roles/invalid_roles.bpmn b/tests/data/invalid_roles/invalid_roles.bpmn index de10f712..b68d186a 100644 --- a/tests/data/invalid_roles/invalid_roles.bpmn +++ b/tests/data/invalid_roles/invalid_roles.bpmn @@ -25,7 +25,7 @@ - + Flow_0a7090c @@ -48,13 +48,7 @@ Your supervisor provided the following feedback: {{feedback}} -You are all done! WARNING: If you go back and reanswer the questions it will create a new approval request. - - - - - - +You are all done! WARNING: If you go back and reanswer the questions it will create a new approval request. Flow_1g38q6b @@ -68,13 +62,7 @@ Your Supervisor provided the following feedback: {{feedback}} -Please press save to re-try the questions, and submit your responses again. - - - - - - +Please press save to re-try the questions, and submit your responses again. Flow_0vnghsi Flow_070gq5r @@ -108,29 +96,21 @@ Please press save to re-try the questions, and submit your responses again. - - - - - + + - - - + + + + + - - - - - - - - - - + + + @@ -140,15 +120,20 @@ Please press save to re-try the questions, and submit your responses again. - - - + + + + + + - - - - - + + + + + + + @@ -168,6 +153,9 @@ Please press save to re-try the questions, and submit your responses again. + + + diff --git a/tests/data/workflow_form_field_type/workflow_form_field_type.bpmn b/tests/data/workflow_form_field_type/workflow_form_field_type.bpmn new file mode 100644 index 00000000..aa4b010f --- /dev/null +++ b/tests/data/workflow_form_field_type/workflow_form_field_type.bpmn @@ -0,0 +1,72 @@ + + + + + Flow_1wfzn0v + + + + + + Flow_1yrn6kp + + + + + + + + + Flow_1wfzn0v + Flow_0e9yohi + + + Flow_0e9yohi + Flow_1nt2lx5 + print('Hello', name) + + + Flow_1nt2lx5 + Flow_1yrn6kp + print('Thank You') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_email_script.py b/tests/test_email_script.py index 42257d4b..ee3d7219 100644 --- a/tests/test_email_script.py +++ b/tests/test_email_script.py @@ -2,20 +2,6 @@ from tests.base_test import BaseTest from crc import mail -# class TestEmailDirectly(BaseTest): -# -# def test_email_directly(self): -# recipients = ['michaelc@cullerton.com'] -# sender = 'michaelc@cullerton.com' -# with mail.record_messages() as outbox: -# mail.send_message(subject='testing', -# body='test', -# recipients=recipients, -# sender=sender) -# assert len(outbox) == 1 -# assert outbox[0].subject == "testing" - - class TestEmailScript(BaseTest): def test_email_script(self): @@ -57,7 +43,6 @@ class TestEmailScript(BaseTest): with self.assertRaises(AssertionError): self.complete_form(workflow, first_task, {'email_address': 'test@example'}) - def test_bad_email_address_2(self): workflow = self.create_workflow('email_script') diff --git a/tests/workflow/test_workflow_form_field_type.py b/tests/workflow/test_workflow_form_field_type.py new file mode 100644 index 00000000..406d2669 --- /dev/null +++ b/tests/workflow/test_workflow_form_field_type.py @@ -0,0 +1,14 @@ +import json +from tests.base_test import BaseTest + + +class TestFormFieldType(BaseTest): + + def test_form_field_type(self): + spec_model = self.load_test_spec('workflow_form_field_type') + rv = self.app.get('/v1.0/workflow-specification/%s/validate' % spec_model.id, headers=self.logged_in_headers()) + + json_data = json.loads(rv.get_data(as_text=True)) + self.assertEqual(json_data[0]['message'], + 'When populating all fields ... Field type is None. A field type must be provided.') + # print('TestFormFieldType: Good Form')