def setUpClass(cls):
        wf_fmt = u'workflow_{0}'
        tsk_fmt = u'task_{0}'
        for i in range(1, 10):
            wf_tmp = db_api.workflow_create('', wf_fmt.format(i))
            tsk_tmp = db_api.task_create('', tsk_fmt.format(i), i, i)

            db_api.workflow_add_task('', wf_fmt.format(i), i)

            cls.tsk_ids.append(i)
            cls.tsk_names.append(tsk_fmt.format(i))
            cls.wf_ids.append(i)
            cls.wf_names.append(wf_fmt.format(i))
Example #2
0
    def setUpClass(cls):
        wf_fmt = u'workflow_{0}'
        tsk_fmt = u'task_{0}'
        for i in range(1, 10):
            wf_tmp = db_api.workflow_create('', wf_fmt.format(i))
            tsk_tmp = db_api.task_create('', tsk_fmt.format(i), i, i)

            db_api.workflow_add_task('', wf_fmt.format(i), i)

            cls.tsk_ids.append(i)
            cls.tsk_names.append(tsk_fmt.format(i))
            cls.wf_ids.append(i)
            cls.wf_names.append(wf_fmt.format(i))
    def test_workflow_add_task(self):
        tsk_tmp = db_api.task_create('', u'task_10', 1, 10)
        db_api.workflow_add_task('', u'workflow_1', 10)
        self.tsk_ids.append(10)
        self.tsk_names.append('task_10')
        expected = [self.tsk_names[0], self.tsk_names[9]]
        tsks = db_api.workflow_get_tasks('', u'workflow_1')
        actual = [tsks[0].name, tsks[1].name]

        self.assertEquals(expected, actual)

        self.assertRaises(exception.NotFound, db_api.workflow_add_task, '',
                          u'workflow_9001', 10)
        self.assertRaises(exception.NotFound, db_api.workflow_add_task, '',
                          u'workflow_1', 9001)
Example #4
0
    def test_workflow_add_task(self):
        tsk_tmp = db_api.task_create('', u'task_10', 1, 10)
        db_api.workflow_add_task('', u'workflow_1', 10)
        self.tsk_ids.append(10)
        self.tsk_names.append('task_10')
        expected = [self.tsk_names[0], self.tsk_names[9]]
        tsks = db_api.workflow_get_tasks('', u'workflow_1')
        actual = [tsks[0].name, tsks[1].name]

        self.assertEquals(expected, actual)

        self.assertRaises(exception.NotFound, db_api.workflow_add_task, '',
                          u'workflow_9001', 10)
        self.assertRaises(exception.NotFound, db_api.workflow_add_task, '',
                          u'workflow_1', 9001)