From a53e2db22318ce58f37638961fda6f50607211d8 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 14 May 2021 13:10:06 -0400 Subject: [PATCH] Final test for study_info script --- tests/test_study_info_script.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/test_study_info_script.py b/tests/test_study_info_script.py index 808cad57..af2e851f 100644 --- a/tests/test_study_info_script.py +++ b/tests/test_study_info_script.py @@ -33,13 +33,17 @@ class TestStudyInfoScript(BaseTest): self.assertEqual(study_info['primary_investigator_id'], second_task.data['info']['primary_investigator_id']) self.assertIn(study_info['title'], second_task.documentation) - def test_info_script_investigators(self): - # We don't have a test for this yet - # I believe we just need to set up some test data. - # study_info, second_task = self.do_work(info_type='investigators') - # if study_info: - # # TODO: add investigators with user_ids that are not None - pass + @patch('crc.services.protocol_builder.requests.get') + def test_info_script_investigators(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') + response = ProtocolBuilderService.get_investigators(self.test_study_id) + study_info, second_task = self.do_work(info_type='investigators') + for i in range(len(response)): + r = response[i] + s = second_task.data['info'][response[i]['INVESTIGATORTYPE']] + self.assertEqual(r['INVESTIGATORTYPEFULL'], s['label']) def test_info_script_roles(self): study_info, second_task = self.do_work(info_type='roles')