diff --git a/crc/static/bpmn/group_test/group_test.bpmn b/crc/static/bpmn/group_test/group_test.bpmn deleted file mode 100644 index aed16ffd..00000000 --- a/crc/static/bpmn/group_test/group_test.bpmn +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Flow_1gnws9u - - - - Flow_1xria19 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Flow_1gnws9u - Flow_0zud2rb - - - - lookup_dropdown: {{ lookup_dropdown }} -lookup_checkbox: {{ lookup_checkbox }} -lookup_radio: {{ lookup_radio }} - - - Flow_0zud2rb - Flow_1xria19 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/crc/static/bpmn/group_test/lookup.xlsx b/crc/static/bpmn/group_test/lookup.xlsx deleted file mode 100644 index 2861a655..00000000 Binary files a/crc/static/bpmn/group_test/lookup.xlsx and /dev/null differ diff --git a/crc/static/bpmn/ids_full_submission/ids_full_submission.bpmn b/crc/static/bpmn/ids_full_submission/ids_full_submission.bpmn index 719b3257..72fece25 100644 --- a/crc/static/bpmn/ids_full_submission/ids_full_submission.bpmn +++ b/crc/static/bpmn/ids_full_submission/ids_full_submission.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1dexemq @@ -100,7 +100,7 @@ Protocol Owner: **(need to insert value here)** - + @@ -123,7 +123,7 @@ Protocol Owner: **(need to insert value here)** - + @@ -159,13 +159,13 @@ Protocol Owner: **(need to insert value here)** - + - + @@ -206,7 +206,7 @@ Protocol Owner: **(need to insert value here)** - + SequenceFlow_0lixqzs @@ -223,122 +223,122 @@ Protocol Owner: **(need to insert value here)** - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/example_data.py b/example_data.py index 80df124d..98746c50 100644 --- a/example_data.py +++ b/example_data.py @@ -69,12 +69,6 @@ class ExampleDataLoader: db.session.commit() # Pass IRB Review - self.create_spec(id="group_test", - name="group_test", - display_name="Group Test", - description="TBD", - category_id=0, - display_order=0) self.create_spec(id="irb_api_personnel", name="irb_api_personnel", display_name="Personnel", diff --git a/tests/test_tasks_api.py b/tests/test_tasks_api.py index 7a7f3c76..ebe99d93 100644 --- a/tests/test_tasks_api.py +++ b/tests/test_tasks_api.py @@ -83,6 +83,17 @@ class TestTasksApi(BaseTest): workflow = WorkflowApiSchema().load(json_data) return workflow + def assert_options_populated(self, results, lookup_data_keys): + option_keys = ['value', 'label', 'data'] + self.assertIsInstance(results, list) + for result in results: + for option_key in option_keys: + self.assertTrue(option_key in result, 'should have value, label, and data properties populated') + self.assertIsNotNone(result[option_key], '%s should not be None' % option_key) + + self.assertIsInstance(result['data'], dict) + for lookup_data_key in lookup_data_keys: + self.assertTrue(lookup_data_key in result['data'], 'should have all lookup data columns populated') def test_get_current_user_tasks(self): self.load_example_data() @@ -342,6 +353,7 @@ class TestTasksApi(BaseTest): self.assert_success(rv) results = json.loads(rv.get_data(as_text=True)) self.assertEqual(5, len(results)) + self.assert_options_populated(results, ['CUSTOMER_NUMBER', 'CUSTOMER_NAME', 'CUSTOMER_CLASS_MEANING']) def test_lookup_endpoint_for_task_field_using_lookup_entry_id(self): self.load_example_data() @@ -357,13 +369,15 @@ class TestTasksApi(BaseTest): self.assert_success(rv) results = json.loads(rv.get_data(as_text=True)) self.assertEqual(5, len(results)) + self.assert_options_populated(results, ['CUSTOMER_NUMBER', 'CUSTOMER_NAME', 'CUSTOMER_CLASS_MEANING']) + rv = self.app.get('/v1.0/workflow/%i/lookup/%s?value=%s' % (workflow.id, field_id, results[0]['value']), # All records with a word that starts with 'c' headers=self.logged_in_headers(), content_type="application/json") results = json.loads(rv.get_data(as_text=True)) self.assertEqual(1, len(results)) - self.assertIsInstance(results[0]['data'], dict) + self.assert_options_populated(results, ['CUSTOMER_NUMBER', 'CUSTOMER_NAME', 'CUSTOMER_CLASS_MEANING']) self.assertNotIn('id', results[0], "Don't include the internal id, that can be very confusing, and should not be used.") def test_lookup_endpoint_also_works_for_enum(self): @@ -371,7 +385,7 @@ class TestTasksApi(BaseTest): # In the event of an auto-complete it's a type-ahead search field, for an enum the # the key/values from the spreadsheet are added directly to the form and it shows up as # a dropdown. This tests the case of wanting to get additional data when a user selects - # something from a drodown. + # something from a dropdown. self.load_example_data() workflow = self.create_workflow('enum_options_from_file') # get the first form in the two form workflow. @@ -386,6 +400,7 @@ class TestTasksApi(BaseTest): self.assert_success(rv) results = json.loads(rv.get_data(as_text=True)) self.assertEqual(1, len(results)) + self.assert_options_populated(results, ['CUSTOMER_NUMBER', 'CUSTOMER_NAME', 'CUSTOMER_CLASS_MEANING']) self.assertIsInstance(results[0]['data'], dict) def test_lookup_endpoint_for_task_ldap_field_lookup(self): @@ -402,6 +417,9 @@ class TestTasksApi(BaseTest): content_type="application/json") self.assert_success(rv) results = json.loads(rv.get_data(as_text=True)) + self.assert_options_populated(results, ['telephone_number', 'affiliation', 'uid', 'title', + 'given_name', 'department', 'date_cached', 'sponsor_type', + 'display_name', 'email_address']) self.assertEqual(1, len(results)) def test_sub_process(self):