From 70651e2a6a5afbe9228c4194eb6611bd231a4fc8 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 4 Jun 2021 11:45:51 -0400 Subject: [PATCH] Test and BPMN files for testing --- .../get_study_associate.bpmn | 62 +++++++++++++++++++ .../test_get_study_associate_validation.py | 13 ++++ 2 files changed, 75 insertions(+) create mode 100644 tests/data/get_study_associate/get_study_associate.bpmn create mode 100644 tests/scripts/test_get_study_associate_validation.py diff --git a/tests/data/get_study_associate/get_study_associate.bpmn b/tests/data/get_study_associate/get_study_associate.bpmn new file mode 100644 index 00000000..5e79f176 --- /dev/null +++ b/tests/data/get_study_associate/get_study_associate.bpmn @@ -0,0 +1,62 @@ + + + + + Flow_1aycav1 + + + + Flow_1aycav1 + Flow_0wkyatv + pi = study_info('investigators').get('PI', False) +if pi: + try: + pi_assc = get_study_associate(pi.user_id) + except: + pi_assc_chk = False + else: + if pi_assc['role'] == "Primary Investigator": + pi_assc_chk = True + else: + pi_assc_chk = False + + + + pi_assc_chk is {{pi_assc_chk}} + Flow_0wkyatv + Flow_0784fc6 + + + Flow_0784fc6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/scripts/test_get_study_associate_validation.py b/tests/scripts/test_get_study_associate_validation.py new file mode 100644 index 00000000..15ae4804 --- /dev/null +++ b/tests/scripts/test_get_study_associate_validation.py @@ -0,0 +1,13 @@ +from tests.base_test import BaseTest +from crc import app + + +class TestGetStudyAssociateValidation(BaseTest): + + def test_get_study_associate_validation(self): + + self.load_example_data() + workflow = self.create_workflow('get_study_associate') + rv = self.app.get('/v1.0/workflow-specification/%s/validate' % workflow.workflow_spec_id, + headers=self.logged_in_headers()) + self.assertEqual(0, len(rv.json))