fixing a failing test, don't assume the study and workflow ids will always be 1.

This commit is contained in:
Dan 2021-07-12 10:00:39 -04:00
parent 1916c4ff54
commit f982745d32
3 changed files with 9 additions and 8 deletions

View File

@ -9,7 +9,7 @@ class GetStudyAssociates(Script):
def get_description(self): def get_description(self):
return """ return """
Returns person assocated with study or an error if one is not associated. Returns people associated with a study or an error if one is not associated.
example : get_study_associate('sbp3ey') => {'uid':'sbp3ey','role':'Unicorn Herder', 'send_email': False, example : get_study_associate('sbp3ey') => {'uid':'sbp3ey','role':'Unicorn Herder', 'send_email': False,
'access':True} 'access':True}

View File

@ -14,12 +14,12 @@ from crc import db, session, app
from crc.api.common import ApiError from crc.api.common import ApiError
from crc.models.data_store import DataStoreModel from crc.models.data_store import DataStoreModel
from crc.models.email import EmailModel from crc.models.email import EmailModel
from crc.models.file import FileDataModel, FileModel, FileModelSchema, File, LookupFileModel, LookupDataModel from crc.models.file import FileModel, File
from crc.models.ldap import LdapSchema from crc.models.ldap import LdapSchema
from crc.models.protocol_builder import ProtocolBuilderStudy, ProtocolBuilderStatus from crc.models.protocol_builder import ProtocolBuilderStudy
from crc.models.study import StudyModel, Study, StudyStatus, Category, WorkflowMetadata, StudyEventType, StudyEvent, \ from crc.models.study import StudyModel, Study, StudyStatus, Category, \
IrbStatus, StudyAssociated WorkflowMetadata, StudyEventType, StudyEvent, IrbStatus, StudyAssociated
from crc.models.task_event import TaskEventModel, TaskEvent from crc.models.task_event import TaskEventModel
from crc.models.workflow import WorkflowSpecCategoryModel, WorkflowModel, WorkflowSpecModel, WorkflowState, \ from crc.models.workflow import WorkflowSpecCategoryModel, WorkflowModel, WorkflowSpecModel, WorkflowState, \
WorkflowStatus, WorkflowSpecDependencyFile WorkflowStatus, WorkflowSpecDependencyFile
from crc.services.document_service import DocumentService from crc.services.document_service import DocumentService
@ -29,6 +29,7 @@ from crc.services.lookup_service import LookupService
from crc.services.protocol_builder import ProtocolBuilderService from crc.services.protocol_builder import ProtocolBuilderService
from crc.services.workflow_processor import WorkflowProcessor from crc.services.workflow_processor import WorkflowProcessor
class StudyService(object): class StudyService(object):
"""Provides common tools for working with a Study""" """Provides common tools for working with a Study"""
INVESTIGATOR_LIST = "investigators.xlsx" # A reference document containing details about what investigators to show, and when. INVESTIGATOR_LIST = "investigators.xlsx" # A reference document containing details about what investigators to show, and when.

View File

@ -40,7 +40,7 @@ class TestTimerEvent(BaseTest):
with self.assertLogs('crc', level='ERROR') as cm: with self.assertLogs('crc', level='ERROR') as cm:
WorkflowService.do_waiting() WorkflowService.do_waiting()
self.assertEqual(1, len(cm.output)) self.assertEqual(1, len(cm.output))
self.assertRegexpMatches(cm.output[0], "workflow #1") self.assertRegexpMatches(cm.output[0], f"workflow #%i" % workflow.id)
self.assertRegexpMatches(cm.output[0], "study #1") self.assertRegexpMatches(cm.output[0], f"study #%i" % workflow.study_id)
self.assertTrue(wf.status == WorkflowStatus.waiting) self.assertTrue(wf.status == WorkflowStatus.waiting)