Exemplo n.º 1
0
 def test_run_one_fail_task_with_error_message(self):
     task = DummyTask(D3RParameters(), 'foo', 'someerror', True, None, None)
     task.set_name('dummy')
     task_list = []
     task_list.append(task)
     self.assertEquals(celpprunner.run_tasks(task_list), 1)
     self.assertEquals(task.get_error(), 'someerror')
Exemplo n.º 2
0
 def test_run_one_successful_task(self):
     success_task = DummyTask(D3RParameters(), 'foo', None, True, None,
                              None)
     success_task.set_name('dummy')
     task_list = []
     task_list.append(success_task)
     self.assertEquals(celpprunner.run_tasks(task_list), 0)
Exemplo n.º 3
0
    def test_run_two_tasks_success(self):
        task_list = []
        task = DummyTask(D3RParameters(), 'foo', None, True, None, None)
        task.set_name('dummy')
        task_list.append(task)
        task_list.append(task)

        self.assertEquals(celpprunner.run_tasks(task_list), 0)
        self.assertEquals(task._run_count, 2)
Exemplo n.º 4
0
 def test_run_one_fail_task_with_exception_and_no_message(self):
     task = DummyTask(D3RParameters(), 'foo', None, True,
                      None, Exception('hi'))
     task.set_name('dummy')
     task_list = []
     task_list.append(task)
     self.assertEquals(celpprunner.run_tasks(task_list), 1)
     self.assertEquals(task.get_error(),
                       'Caught Exception running task: hi')
Exemplo n.º 5
0
    def test_run_two_tasks_second_task_has_error(self):
        task_list = []
        task = DummyTask(D3RParameters(), 'foo', None, True, None, None)
        task.set_name('dummy')
        task_list.append(task)

        task_two = DummyTask(D3RParameters(), 'foo', None, True,
                             None, Exception('hi'))
        task_two.set_name('dummy')
        task_list.append(task_two)

        self.assertEquals(celpprunner.run_tasks(task_list), 1)
        self.assertEquals(task._run_count, 1)
        self.assertEquals(task_two._run_count, 1)
        self.assertEquals(task_two.get_error(),
                          'Caught Exception running task: hi')
Exemplo n.º 6
0
 def test_run_tasks_passing_none_and_empty_list(self):
     self.assertEquals(celpprunner.run_tasks(None), 3)
     task_list = []
     self.assertEquals(celpprunner.run_tasks(task_list), 2)