示例#1
0
    def test_task_get(self):
        expected = self.tsk_names[0]
        actual = db_api.task_get('', self.tsk_ids[0])

        self.assertEquals(expected, actual.name)

        self.assertRaises(exception.NotFound, db_api.task_get, '', 9001)
示例#2
0
    def test_task_get(self):
        expected = self.tsk_names[0]
        actual = db_api.task_get('', self.tsk_ids[0])

        self.assertEquals(expected, actual.name)

        self.assertRaises(exception.NotFound, db_api.task_get, '', 9001)
示例#3
0
    def test_task_create(self):
        id = 1
        while (self.tsk_ids.count(id) > 0):
            id = id + 1
        tsk_tmp = db_api.task_create('', u'task_{0}'.format(id), 1, id)
        self.tsk_ids.append(id)
        self.tsk_names.append(u'task_{0}'.format(id))

        self.assertIsNotNone(db_api.task_get('', id))
示例#4
0
    def test_task_create(self):
        id = 1
        while (self.tsk_ids.count(id) > 0):
            id = id + 1
        tsk_tmp = db_api.task_create('', u'task_{0}'.format(id), 1, id)
        self.tsk_ids.append(id)
        self.tsk_names.append(u'task_{0}'.format(id))

        self.assertIsNotNone(db_api.task_get('', id))
示例#5
0
    def test_task_update(self):
        db_api.task_update('', 1, dict(exception='ExceptionTest',
                           stacktrace='StacktraceTest'))
        task = db_api.task_get('', 1)

        expected = 'ExceptionTest'
        actual = task.exception

        self.assertEquals(expected, actual)

        expected = 'StacktraceTest'
        actual = task.stacktrace

        self.assertEquals(expected, actual)

        self.assertRaises(exception.NotFound, db_api.task_update, '', 9001,
                          dict(exception='ExceptionTest', stacktrace='StacktraceTest'))
示例#6
0
    def test_task_update(self):
        db_api.task_update(
            '', 1, dict(exception='ExceptionTest',
                        stacktrace='StacktraceTest'))
        task = db_api.task_get('', 1)

        expected = 'ExceptionTest'
        actual = task.exception

        self.assertEquals(expected, actual)

        expected = 'StacktraceTest'
        actual = task.stacktrace

        self.assertEquals(expected, actual)

        self.assertRaises(
            exception.NotFound, db_api.task_update, '', 9001,
            dict(exception='ExceptionTest', stacktrace='StacktraceTest'))