Modified `test_get_all_studies` so they don't fail looking for studies that are open for enrollment

We will soon have a new way to automatically set study status to `Open for Enrollment`, so I left the failing tests there and commented them out for now.
This commit is contained in:
mike cullerton 2021-08-13 12:32:11 -04:00
parent bd4a9cced3
commit 58119c8969
1 changed files with 9 additions and 5 deletions

View File

@ -190,17 +190,19 @@ class TestStudyApi(BaseTest):
num_abandoned += 1
if study['status'] == 'in_progress': # One study is marked complete without HSR Number
num_in_progress += 1
if study['status'] == 'open_for_enrollment': # One study is marked complete and has an HSR Number
if study['status'] == 'open_for_enrollment': # Currently, we don't automatically set studies to open for enrollment
num_open += 1
db_studies_after = session.query(StudyModel).all()
num_db_studies_after = len(db_studies_after)
self.assertGreater(num_db_studies_after, num_db_studies_before)
self.assertEqual(num_abandoned, 1)
self.assertEqual(num_open, 1)
self.assertEqual(num_open, 0) # Currently, we don't automatically set studies to open for enrollment
self.assertEqual(num_in_progress, 2)
self.assertEqual(len(json_data), num_db_studies_after)
self.assertEqual(num_open + num_in_progress + num_abandoned, num_db_studies_after)
# The count is off, since we don't automatically set studies to Open for Enrollment
# This will likely change in the future
# self.assertEqual(num_open + num_in_progress + num_abandoned, num_db_studies_after)
# Automatic events check
in_progress_events = session.query(StudyEvent).filter_by(status=StudyStatus.in_progress)
@ -209,8 +211,10 @@ class TestStudyApi(BaseTest):
abandoned_events = session.query(StudyEvent).filter_by(status=StudyStatus.abandoned)
self.assertEqual(abandoned_events.count(), 1) # 1 study has been abandoned
open_for_enrollment_events = session.query(StudyEvent).filter_by(status=StudyStatus.open_for_enrollment)
self.assertEqual(open_for_enrollment_events.count(), 1) # 1 study was moved to open for enrollment
# We don't currently set any studies to Open for Enrollment automatically
# This will likely change
# open_for_enrollment_events = session.query(StudyEvent).filter_by(status=StudyStatus.open_for_enrollment)
# self.assertEqual(open_for_enrollment_events.count(), 1) # 1 study was moved to open for enrollment
@patch('crc.services.protocol_builder.ProtocolBuilderService.get_investigators') # mock_studies
@patch('crc.services.protocol_builder.ProtocolBuilderService.get_required_docs') # mock_docs