Remove code that doesn't let master workflow set state and state_message for admin sandbox workflows

Remove test for this feature
This commit is contained in:
mike cullerton 2022-05-26 13:35:30 -04:00
parent 5b2b2f7b60
commit 95c915a434
2 changed files with 2 additions and 25 deletions

View File

@ -1148,11 +1148,6 @@ class WorkflowService(object):
if WorkflowState.has_value(workflow_state): if WorkflowState.has_value(workflow_state):
# Get the workflow from our dictionary and set the state # Get the workflow from our dictionary and set the state
workflow = wf_by_workflow_spec_id[workflow_spec_id] workflow = wf_by_workflow_spec_id[workflow_spec_id]
# Don't let the master workflow change the state for admin workflows
if WorkflowService.is_admin_workflow(workflow_spec_id):
workflow.state = 'optional'
workflow.state_message = 'This is an Admin workflow'
else:
workflow.state = workflow_state workflow.state = workflow_state
workflow.state_message = workflow_state_message workflow.state_message = workflow_state_message
session.add(workflow) session.add(workflow)

View File

@ -102,24 +102,6 @@ class TestStudyApi(BaseTest):
self.assertEqual('Completion of this workflow is required.', workflows[0].state_message) self.assertEqual('Completion of this workflow is required.', workflows[0].state_message)
self.assertEqual('This workflow is locked', workflows[1].state_message) self.assertEqual('This workflow is locked', workflows[1].state_message)
def test_admin_workflows_not_locked(self):
"""Admin category workflows should not be locked by the master workflow"""
# Add an admin category
self.assure_category_exists('test_admin_category', admin=True)
# Add a workflow to the admin category
self.load_test_spec('empty_workflow', category_id='test_admin_category')
# Add a master workflow that tries to lock the workflow
self.load_test_spec('test_master_workflow', master_spec=True)
study = self.add_test_study()
study_model = session.query(StudyModel).filter_by(id=study["id"]).first()
self.run_master_spec(study_model)
workflows = session.query(WorkflowModel).all()
self.assertEqual(1, len(workflows))
# The master workflow tries to lock this, but we don't lock if Admin category
self.assertEqual('optional', workflows[0].state)
def test_get_study_has_details_about_files(self): def test_get_study_has_details_about_files(self):
# Set up the study and attach a file to it. # Set up the study and attach a file to it.