mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 12:48:25 +00:00
It used to return `True`, and this caused shield validation to fail when looping over the results of `get_study_associates`. (You can't loop over a boolean) Added a for loop in `study_sponsors_associate.bpmn` to test for this. Moved `BaseTest` import to the top of `test_study_associate_script` because debug was failing.
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
from crc.api.common import ApiError
|
|
from crc.scripts.script import Script
|
|
from crc.services.study_service import StudyService
|
|
|
|
|
|
class GetStudyAssociates(Script):
|
|
|
|
argument_error_message = "You must supply at least one argument to the " \
|
|
"update_study_associates task, an array of objects in the form " \
|
|
"{'uid':'someid', 'role': 'text', 'send_email: 'boolean', " \
|
|
"'access':'boolean'} "
|
|
|
|
|
|
def get_description(self):
|
|
return """
|
|
Returns all people associated with the study - Will always return the study owner as assocated
|
|
example : get_study_associates() => [{'uid':'sbp3ey','role':'Unicorn Herder', 'send_email': False, 'access':True}]
|
|
|
|
"""
|
|
|
|
def do_task_validate_only(self, task, study_id, workflow_id, *args, **kwargs):
|
|
study_associates = [
|
|
{'uid': 'dhf8r', 'role': 'Chief Bee Keeper', 'send_email': True, 'access': True},
|
|
{'uid': 'lb3dp', 'role': 'Chief Cat Herder', 'send_email': True, 'access': True}
|
|
]
|
|
return study_associates
|
|
|
|
def do_task(self, task, study_id, workflow_id, *args, **kwargs):
|
|
|
|
return StudyService.get_study_associates(study_id)
|
|
|
|
|