From 89e02c6207080f6d3e57918f487880c6f54648f0 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 9 Feb 2022 13:37:57 -0500 Subject: [PATCH] really need to avoid any kind of caching in the WorkflowSpecService --- crc/services/workflow_processor.py | 2 ++ tests/base_test.py | 1 + tests/scripts/test_get_localtime.py | 4 ---- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crc/services/workflow_processor.py b/crc/services/workflow_processor.py index 808d2290..953abdc2 100644 --- a/crc/services/workflow_processor.py +++ b/crc/services/workflow_processor.py @@ -109,6 +109,8 @@ class WorkflowProcessor(object): if workflow_model.bpmn_workflow_json is None: self.workflow_spec_service.scan_file_system() spec_info = self.workflow_spec_service.get_spec(workflow_model.workflow_spec_id) + if spec_info is None: + raise (ApiError("missing_spec", "The spec this workflow references does not currently exist.")) self.spec_files = SpecFileService.get_files(spec_info, include_libraries=True) spec = self.get_spec(self.spec_files, spec_info) diff --git a/tests/base_test.py b/tests/base_test.py index 41757e34..0ddebc2a 100644 --- a/tests/base_test.py +++ b/tests/base_test.py @@ -307,6 +307,7 @@ class BaseTest(unittest.TestCase): def create_workflow(self, dir_name, display_name=None, study=None, category_id=None, as_user="dhf8r"): session.flush() + self.workflow_spec_service.scan_file_system() spec = self.workflow_spec_service.get_spec(dir_name) if spec is None: if display_name is None: diff --git a/tests/scripts/test_get_localtime.py b/tests/scripts/test_get_localtime.py index de54a982..af930439 100644 --- a/tests/scripts/test_get_localtime.py +++ b/tests/scripts/test_get_localtime.py @@ -7,8 +7,6 @@ import datetime class TestGetLocaltime(BaseTest): def test_get_localtime(self): - self.load_example_data() - timestamp = datetime.datetime.utcnow() workflow = self.create_workflow('get_localtime') @@ -28,7 +26,6 @@ class TestGetLocaltime(BaseTest): self.assertEqual(dateparser.parse(localtime_without), GetLocaltime().do_task(None, None, None, str(timestamp))) def test_get_localtime_with_timezone(self): - self.load_example_data() timestamp = datetime.datetime.utcnow() workflow = self.create_workflow('get_localtime') @@ -51,7 +48,6 @@ class TestGetLocaltime(BaseTest): def test_get_localtime_no_timestamp(self): workflow = self.create_workflow('get_localtime') - workflow_api = self.get_workflow_api(workflow) task = workflow_api.next_task