Merge branch 'master' of github.com:sartography/cr-connect-workflow

This commit is contained in:
Dan Funk 2020-04-07 14:09:28 -04:00
commit c7a18709ee
5 changed files with 32 additions and 32 deletions

View File

@ -20,12 +20,12 @@ install:
- pip install pipenv pytest coverage awscli
- export PATH=$PATH:$HOME/.local/bin;
- pipenv install
- pytest # <== This runs in Pipenv (a/k/a virtualenv)
# command to run tests
script:
- coverage run -m pytest
- coverage xml -i
- pipenv run coverage run -m pytest
- pipenv run coverage xml -i
after_success:
- sonar-scanner
deploy:

View File

@ -21,10 +21,10 @@ class TestProtocolBuilder(BaseTest):
mock_get.return_value.text = self.protocol_builder_response('investigators.json')
response = ProtocolBuilderService.get_investigators(self.test_study_id)
self.assertIsNotNone(response)
self.assertEquals(3, len(response))
self.assertEquals("DC", response[0]["INVESTIGATORTYPE"])
self.assertEquals("Department Contact", response[0]["INVESTIGATORTYPEFULL"])
self.assertEquals("asd3v", response[0]["NETBADGEID"])
self.assertEqual(3, len(response))
self.assertEqual("DC", response[0]["INVESTIGATORTYPE"])
self.assertEqual("Department Contact", response[0]["INVESTIGATORTYPEFULL"])
self.assertEqual("asd3v", response[0]["NETBADGEID"])
@patch('crc.services.protocol_builder.requests.get')
def test_get_required_docs(self, mock_get):
@ -32,8 +32,8 @@ class TestProtocolBuilder(BaseTest):
mock_get.return_value.text = self.protocol_builder_response('required_docs.json')
response = ProtocolBuilderService.get_required_docs(self.test_study_id)
self.assertIsNotNone(response)
self.assertEquals(5, len(response))
self.assertEquals("6", response[0]['AUXDOCID'])
self.assertEqual(5, len(response))
self.assertEqual("6", response[0]['AUXDOCID'])
@patch('crc.services.protocol_builder.requests.get')
def test_get_details(self, mock_get):
@ -41,5 +41,5 @@ class TestProtocolBuilder(BaseTest):
mock_get.return_value.text = self.protocol_builder_response('study_details.json')
response = ProtocolBuilderService.get_study_details(self.test_study_id)
self.assertIsNotNone(response)
self.assertEquals(64, len(response))
self.assertEquals(1234, response['IND_1'])
self.assertEqual(64, len(response))
self.assertEqual(1234, response['IND_1'])

View File

@ -31,7 +31,7 @@ class TestRequiredDocsScript(BaseTest):
db.session.flush()
errors = Documents.validate()
self.assertTrue(len(errors) > 0)
self.assertEquals("file_not_found", errors[0].code)
self.assertEqual("file_not_found", errors[0].code)
def test_no_validation_error_when_correct_file_exists(self):
self.create_reference_document()
@ -54,11 +54,11 @@ class TestRequiredDocsScript(BaseTest):
documents = script.get_documents(12, pb_docs) # Mocked out, any random study id works.
self.assertIsNotNone(documents)
self.assertTrue("UVACompl_PRCAppr" in documents.keys())
self.assertEquals("Cancer Center's PRC Approval Form", documents["UVACompl_PRCAppr"]['Name'])
self.assertEquals("UVA Compliance", documents["UVACompl_PRCAppr"]['category1'])
self.assertEquals("PRC Approval", documents["UVACompl_PRCAppr"]['category2'])
self.assertEquals("CRC", documents["UVACompl_PRCAppr"]['Who Uploads?'])
self.assertEquals(0, documents["UVACompl_PRCAppr"]['count'])
self.assertEqual("Cancer Center's PRC Approval Form", documents["UVACompl_PRCAppr"]['Name'])
self.assertEqual("UVA Compliance", documents["UVACompl_PRCAppr"]['category1'])
self.assertEqual("PRC Approval", documents["UVACompl_PRCAppr"]['category2'])
self.assertEqual("CRC", documents["UVACompl_PRCAppr"]['Who Uploads?'])
self.assertEqual(0, documents["UVACompl_PRCAppr"]['count'])
def test_get_required_docs_has_correct_count_when_a_file_exists(self):
self.load_example_data()
@ -77,4 +77,4 @@ class TestRequiredDocsScript(BaseTest):
docs = script.get_documents(workflow.study_id, pb_docs)
self.assertIsNotNone(docs)
self.assertEquals(1, docs["UVACompl_PRCAppr"]['count'])
self.assertEqual(1, docs["UVACompl_PRCAppr"]['count'])

View File

@ -93,7 +93,7 @@ class TestStudyApi(BaseTest):
workflow_spec_count =session.query(WorkflowSpecModel).filter(WorkflowSpecModel.is_master_spec == False).count()
workflow_count = session.query(WorkflowModel).filter(WorkflowModel.study_id == 12345).count()
error_count = len(study["errors"])
self.assertEquals(workflow_spec_count, workflow_count + error_count)
self.assertEqual(workflow_spec_count, workflow_count + error_count)
def test_update_study(self):
self.load_example_data()

View File

@ -45,24 +45,24 @@ class TestWorkflowSpecValidation(BaseTest):
def test_invalid_expression(self):
errors = self.validate_workflow("invalid_expression")
self.assertEqual(1, len(errors))
self.assertEquals("invalid_expression", errors[0]['code'])
self.assertEquals("ExclusiveGateway_003amsm", errors[0]['task_id'])
self.assertEquals("Has Bananas Gateway", errors[0]['task_name'])
self.assertEquals("invalid_expression.bpmn", errors[0]['file_name'])
self.assertEquals("The expression you provided does not exist:this_value_does_not_exist==true", errors[0]["message"])
self.assertEqual("invalid_expression", errors[0]['code'])
self.assertEqual("ExclusiveGateway_003amsm", errors[0]['task_id'])
self.assertEqual("Has Bananas Gateway", errors[0]['task_name'])
self.assertEqual("invalid_expression.bpmn", errors[0]['file_name'])
self.assertEqual("The expression you provided does not exist:this_value_does_not_exist==true", errors[0]["message"])
def test_validation_error(self):
errors = self.validate_workflow("invalid_spec")
self.assertEqual(1, len(errors))
self.assertEquals("workflow_validation_error", errors[0]['code'])
self.assertEquals("StartEvent_1", errors[0]['task_id'])
self.assertEquals("invalid_spec.bpmn", errors[0]['file_name'])
self.assertEqual("workflow_validation_error", errors[0]['code'])
self.assertEqual("StartEvent_1", errors[0]['task_id'])
self.assertEqual("invalid_spec.bpmn", errors[0]['file_name'])
def test_invalid_script(self):
errors = self.validate_workflow("invalid_script")
self.assertEqual(1, len(errors))
self.assertEquals("workflow_execution_exception", errors[0]['code'])
self.assertEqual("workflow_execution_exception", errors[0]['code'])
self.assertTrue("NoSuchScript" in errors[0]['message'])
self.assertEquals("Invalid_Script_Task", errors[0]['task_id'])
self.assertEquals("An Invalid Script Reference", errors[0]['task_name'])
self.assertEquals("invalid_script.bpmn", errors[0]['file_name'])
self.assertEqual("Invalid_Script_Task", errors[0]['task_id'])
self.assertEqual("An Invalid Script Reference", errors[0]['task_name'])
self.assertEqual("invalid_script.bpmn", errors[0]['file_name'])