Added test and json data for new check_study pb mock api endpoint

This commit is contained in:
mike cullerton 2021-07-02 15:26:39 -04:00
parent 9690c69b6c
commit 2cb2874a49
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,3 @@
[
{"DETAIL": "Passed validation.", "STATUS": "No Error"}
]

View File

@ -72,3 +72,13 @@ class TestProtocolBuilder(BaseTest):
self.assertEqual('IRB Event 1', response[0]["IRBEVENT"])
self.assertEqual('IRB Event 2', response[1]["IRBEVENT"])
self.assertEqual('IRB Event 3', response[2]["IRBEVENT"])
@patch('crc.services.protocol_builder.requests.get')
def test_check_study(self, mock_get):
app.config['PB_ENABLED'] = True
mock_get.return_value.ok = True
mock_get.return_value.text = self.protocol_builder_response('check_study.json')
response = ProtocolBuilderService.check_study(self.test_study_id)
self.assertIsNotNone(response)
self.assertIn('DETAIL', response[0].keys())
self.assertIn('STATUS', response[0].keys())