Test and mock data for new `get_irb_info` service in ProtocolBuilderService

This commit is contained in:
mike cullerton 2021-05-01 15:23:07 -04:00
parent 22b3230243
commit 1bcf4ea02e
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,38 @@
[
{
"AGENDA_DATE": "2021-04-15T00:00:00+00:00",
"DATE_MODIFIED": "2021-04-15T00:00:00+00:00",
"IRBEVENT": "IRB Event 1",
"IRB_ADMINISTRATIVE_REVIEWER": "IRB Admin Reviewer 1",
"IRB_OF_RECORD": "IRB of Record 1",
"IRB_REVIEW_TYPE": "IRB Review Type 1",
"IRB_STATUS": "IRB Status 1",
"STUDYIRBREVIEWERADMIN": "Study IRB Review Admin 1",
"UVA_IRB_HSR_IS_IRB_OF_RECORD_FOR_ALL_SITES": 1,
"UVA_STUDY_TRACKING": "UVA Study Tracking 1"
},
{
"AGENDA_DATE": "2021-04-15T00:00:00+00:00",
"DATE_MODIFIED": "2021-04-15T00:00:00+00:00",
"IRBEVENT": "IRB Event 2",
"IRB_ADMINISTRATIVE_REVIEWER": "IRB Admin Reviewer 2",
"IRB_OF_RECORD": "IRB of Record 2",
"IRB_REVIEW_TYPE": "IRB Review Type 2",
"IRB_STATUS": "IRB Status 2",
"STUDYIRBREVIEWERADMIN": "Study IRB Review Admin 2",
"UVA_IRB_HSR_IS_IRB_OF_RECORD_FOR_ALL_SITES": 2,
"UVA_STUDY_TRACKING": "UVA Study Tracking 2"
},
{
"AGENDA_DATE": "2021-04-15T00:00:00+00:00",
"DATE_MODIFIED": "2021-04-15T00:00:00+00:00",
"IRBEVENT": "IRB Event 3",
"IRB_ADMINISTRATIVE_REVIEWER": "IRB Admin Reviewer 3",
"IRB_OF_RECORD": "IRB of Record 3",
"IRB_REVIEW_TYPE": "IRB Review Type 3",
"IRB_STATUS": "IRB Status 3",
"STUDYIRBREVIEWERADMIN": "Study IRB Review Admin 3",
"UVA_IRB_HSR_IS_IRB_OF_RECORD_FOR_ALL_SITES": 3,
"UVA_STUDY_TRACKING": "UVA Study Tracking 3"
}
]

View File

@ -60,3 +60,17 @@ class TestProtocolBuilder(BaseTest):
self.assertEqual(2, response[0]["SS_STUDY"])
self.assertEqual(2453, response[0]["SPONSOR_ID"])
self.assertEqual("Abbott Ltd", response[0]["SP_NAME"])
@patch('crc.services.protocol_builder.requests.get')
def test_get_irb_info(self, mock_get):
app.config['PB_ENABLED'] = True
mock_get.return_value.ok = True
mock_get.return_value.text = self.protocol_builder_response('irb_info.json')
response = ProtocolBuilderService.get_irb_info(self.test_study_id)
self.assertIsNotNone(response)
self.assertEqual(3, len(response))
self.assertEqual('IRB Event 1', response[0]["IRBEVENT"])
self.assertEqual('IRB Event 2', response[1]["IRBEVENT"])
self.assertEqual('IRB Event 3', response[2]["IRBEVENT"])
print('test_get_irb_info')