def setUpClass(cls): wf_fmt = u'workflow_{0}' lb_tmp = db_api.logbook_create('', u'logbook_1', 1) cls.lb_ids.append(1) cls.lb_names.append(u'logbook_1') job_tmp = db_api.job_create('', u'job_1', 1) cls.job_ids.append(1) cls.job_names.append(u'job_1') for i in range(1, 10): wf_tmp = db_api.workflow_create('', wf_fmt.format(i)) db_api.logbook_add_workflow('', 1, wf_fmt.format(i)) db_api.job_add_workflow('', 1, wf_fmt.format(i)) cls.wf_ids.append(i) cls.wf_names.append(wf_fmt.format(i))
def test_job_add_workflow(self): db_api.workflow_create('', u'workflow_10') self.wf_ids.append(10) self.wf_names.append(u'workflow_10') expected = self.wf_ids actual = [] temp = db_api.job_add_workflow('', 1, u'workflow_10') for workflow in temp: actual.append(workflow.id) self.assertEquals(expected, actual) self.assertRaises(exception.NotFound, db_api.job_add_workflow, '', 9001, u'workflow_10') self.assertRaises(exception.NotFound, db_api.job_add_workflow, '', 1, u'workflow_9001')