def test_wfjt_admin_can_delete_workflow_job(self, workflow_job, rando): workflow_job.workflow_job_template.admin_role.members.add(rando) access = WorkflowJobAccess(rando) assert not access.can_delete(workflow_job)
def test_cancel_your_own_job(self, wfjt, workflow_job, rando): wfjt.execute_role.members.add(rando) workflow_job.created_by = rando workflow_job.save() access = WorkflowJobAccess(rando) assert access.can_cancel(workflow_job)
def test_org_admin_can_delete_workflow_job(self, workflow_job, org_admin): access = WorkflowJobAccess(org_admin) assert access.can_delete(workflow_job)
def test_execute_role_relaunch(self, wfjt, workflow_job, rando): wfjt.execute_role.members.add(rando) JobLaunchConfig.objects.create(job=workflow_job) assert WorkflowJobAccess(rando).can_start(workflow_job)
def test_admin_cancel_access(self, wfjt, workflow_job, rando): wfjt.admin_role.members.add(rando) access = WorkflowJobAccess(rando) assert access.can_cancel(workflow_job)
def test_org_admin_can_delete_workflow_job(self, role_name, workflow_job, org_member): role = getattr(workflow_job.workflow_job_template.organization, role_name) role.members.add(org_member) access = WorkflowJobAccess(org_member) assert access.can_delete(workflow_job)
def test_cannot_relaunch_friends_job(self, wfjt, rando, alice): workflow_job = wfjt.workflow_jobs.create(name='foo', created_by=alice) JobLaunchConfig.objects.create(job=workflow_job, extra_data={'foo': 'fooforyou'}) wfjt.execute_role.members.add(alice) assert not WorkflowJobAccess(rando).can_start(workflow_job)