Added mocked PB data for tests using study_info script.
This commit is contained in:
parent
37ba46fb8f
commit
9dc5871848
|
@ -19,7 +19,11 @@ class TestSudySponsorsScript(BaseTest):
|
|||
test_study_id = 1
|
||||
|
||||
|
||||
def test_study_sponsors_script_validation(self):
|
||||
@patch('crc.services.protocol_builder.requests.get')
|
||||
def test_study_sponsors_script_validation(self, mock_get):
|
||||
app.config['PB_ENABLED'] = True
|
||||
mock_get.return_value.ok = True
|
||||
mock_get.return_value.text = self.protocol_builder_response('sponsors.json')
|
||||
flask.g.user = UserModel(uid='dhf8r')
|
||||
self.load_example_data() # study_info script complains if irb_documents.xls is not loaded
|
||||
# during the validate phase I'm going to assume that we will never
|
||||
|
|
|
@ -16,7 +16,11 @@ class TestSudySponsorsScript(BaseTest):
|
|||
test_study_id = 1
|
||||
|
||||
|
||||
def test_study_sponsors_script_validation(self):
|
||||
@patch('crc.services.protocol_builder.requests.get')
|
||||
def test_study_sponsors_script_validation(self, mock_get):
|
||||
mock_get.return_value.ok = True
|
||||
mock_get.return_value.text = self.protocol_builder_response('sponsors.json')
|
||||
app.config['PB_ENABLED'] = True
|
||||
flask.g.user = UserModel(uid='dhf8r')
|
||||
self.load_example_data() # study_info script complains if irb_documents.xls is not loaded
|
||||
# during the validate phase I'm going to assume that we will never
|
||||
|
|
|
@ -29,9 +29,23 @@ class TestStudyDetailsScript(BaseTest):
|
|||
self.processor = WorkflowProcessor(self.workflow_model)
|
||||
self.task = self.processor.next_task()
|
||||
|
||||
def test_study_info_returns_a_box_object_for_all_validations(self):
|
||||
@patch('crc.services.protocol_builder.requests.get')
|
||||
def test_study_info_returns_a_box_object_for_all_validations(self, mock_get):
|
||||
app.config['PB_ENABLED'] = True
|
||||
mock_get.return_value.ok = True
|
||||
for option in StudyInfo.type_options:
|
||||
if option == 'info':
|
||||
mock_get.return_value.text = self.protocol_builder_response('irb_info.json')
|
||||
elif option == 'investigators':
|
||||
mock_get.return_value.text = self.protocol_builder_response('investigators.json')
|
||||
elif option == 'roles':
|
||||
mock_get.return_value.text = self.protocol_builder_response('investigators.json')
|
||||
elif option == 'details':
|
||||
mock_get.return_value.text = self.protocol_builder_response('study_details.json')
|
||||
elif option == 'documents':
|
||||
mock_get.return_value.text = self.protocol_builder_response('required_docs.json')
|
||||
elif option == 'sponsors':
|
||||
mock_get.return_value.text = self.protocol_builder_response('sponsors.json')
|
||||
data = StudyInfo().do_task_validate_only(self.task, self.study.id, self.workflow_model.id, option)
|
||||
if isinstance(data, list):
|
||||
for x in data:
|
||||
|
|
|
@ -13,7 +13,12 @@ class TestSudySponsorsScript(BaseTest):
|
|||
test_study_id = 1
|
||||
|
||||
|
||||
def test_study_sponsors_script_validation(self):
|
||||
@patch('crc.services.protocol_builder.requests.get')
|
||||
def test_study_sponsors_script_validation(self, mock_get):
|
||||
mock_get.return_value.ok = True
|
||||
mock_get.return_value.text = self.protocol_builder_response('sponsors.json')
|
||||
app.config['PB_ENABLED'] = True
|
||||
|
||||
self.load_example_data() # study_info script complains if irb_documents.xls is not loaded
|
||||
# during the validate phase I'm going to assume that we will never
|
||||
# have a case where irb_documents.xls is not loaded ??
|
||||
|
|
|
@ -2,12 +2,16 @@ from tests.base_test import BaseTest
|
|||
from crc import app
|
||||
from crc.services.workflow_service import WorkflowService
|
||||
from crc.api.common import ApiError
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestValidateEndEvent(BaseTest):
|
||||
|
||||
def test_validate_end_event(self):
|
||||
@patch('crc.services.protocol_builder.requests.get')
|
||||
def test_validate_end_event(self, mock_get):
|
||||
app.config['PB_ENABLED'] = True
|
||||
mock_get.return_value.ok = True
|
||||
mock_get.return_value.text = self.protocol_builder_response('study_details.json')
|
||||
|
||||
error_string = """Error processing template for task EndEvent_1qvyxg7: expected token 'end of statement block', got '='"""
|
||||
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
from tests.base_test import BaseTest
|
||||
from crc import app
|
||||
import json
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestWorkflowInfiniteLoop(BaseTest):
|
||||
|
||||
def test_workflow_infinite_loop(self):
|
||||
@patch('crc.services.protocol_builder.requests.get')
|
||||
def test_workflow_infinite_loop(self, mock_get):
|
||||
app.config['PB_ENABLED'] = True
|
||||
mock_get.return_value.ok = True
|
||||
mock_get.return_value.text = self.protocol_builder_response('investigators.json')
|
||||
self.load_example_data()
|
||||
spec_model = self.load_test_spec('infinite_loop')
|
||||
rv = self.app.get('/v1.0/workflow-specification/%s/validate' % spec_model.id, headers=self.logged_in_headers())
|
||||
|
|
Loading…
Reference in New Issue