Exemple #1
0
    def test_start_completed_task(self):
        queue = OrderedTaskStatus()
        queue.start_task("create")
        queue.complete_task()

        with self.assertRaises(ValueError):
            queue.start_task("create")
Exemple #2
0
    def test_restart_completed_task(self):
        queue = OrderedTaskStatus()
        queue.start_task("create")
        queue.complete_task()

        queue.start_task("create", allow_restart=True)
        self.assertEqual("create", queue.task)
        self.assertEqual("creating", queue.status)
Exemple #3
0
    def test_skip_task(self):
        queue = OrderedTaskStatus()
        queue.start_task("create")
        queue.complete_task()

        tasks = queue.tasks
        for task in tasks[2:]:
            with self.assertRaises(ValueError):
                queue.start_task(task)
Exemple #4
0
    def test_move_backward(self):
        queue = OrderedTaskStatus()
        for task in queue.tasks:
            queue.start_task(task)
            queue.complete_task()

        tasks = queue.tasks
        for task in tasks[:-1]:
            with self.assertRaises(ValueError):
                queue.start_task(task)
Exemple #5
0
    def test_start_completed_task(self):
        queue = OrderedTaskStatus()
        queue.start_task("create")
        queue.complete_task()

        with self.assertRaises(ValueError):
            queue.start_task("create")
Exemple #6
0
    def test_restart_completed_task(self):
        queue = OrderedTaskStatus()
        queue.start_task("create")
        queue.complete_task()

        queue.start_task("create", allow_restart=True)
        self.assertEqual("create", queue.task)
        self.assertEqual("creating", queue.status)
Exemple #7
0
    def test_skip_task(self):
        queue = OrderedTaskStatus()
        queue.start_task("create")
        queue.complete_task()

        tasks = queue.tasks
        for task in tasks[2:]:
            with self.assertRaises(ValueError):
                queue.start_task(task)
Exemple #8
0
    def test_move_backward(self):
        queue = OrderedTaskStatus()
        for task in queue.tasks:
            queue.start_task(task)
            queue.complete_task()

        tasks = queue.tasks
        for task in tasks[:-1]:
            with self.assertRaises(ValueError):
                queue.start_task(task)
Exemple #9
0
 def test_complete_before_started(self):
     queue = OrderedTaskStatus()
     with self.assertRaises(ValueError):
         queue.complete_task()
Exemple #10
0
 def test_all_tasks(self):
     queue = OrderedTaskStatus()
     for task in queue.tasks:
         queue.start_task(task)
         queue.complete_task()
Exemple #11
0
 def test_start_next_before_finish_current(self):
     queue = OrderedTaskStatus()
     queue.start_task("create")
     with self.assertRaises(ValueError):
         queue.start_task("initialize")
Exemple #12
0
 def test_complete_task(self):
     queue = OrderedTaskStatus()
     queue.start_task("create")
     queue.complete_task()
     self.assertEqual("create", queue.task)
     self.assertEqual("created", queue.status)
Exemple #13
0
 def test_start_task(self):
     queue = OrderedTaskStatus()
     queue.start_task("create")
     self.assertEqual("create", queue.task)
     self.assertEqual("creating", queue.status)
Exemple #14
0
    def test_restart_previous_task(self):
        queue = OrderedTaskStatus()
        queue.start_task("create")
        queue.complete_task()

        queue.start_task("initialize")
        queue.complete_task()

        with self.assertRaises(ValueError):
            queue.start_task("create", allow_restart=True)
Exemple #15
0
 def test_start_task(self):
     queue = OrderedTaskStatus()
     queue.start_task("create")
     self.assertEqual("create", queue.task)
     self.assertEqual("creating", queue.status)
Exemple #16
0
    def test_restart_previous_task(self):
        queue = OrderedTaskStatus()
        queue.start_task("create")
        queue.complete_task()

        queue.start_task("initialize")
        queue.complete_task()

        with self.assertRaises(ValueError):
            queue.start_task("create", allow_restart=True)
Exemple #17
0
 def test_start_next_before_finish_current(self):
     queue = OrderedTaskStatus()
     queue.start_task("create")
     with self.assertRaises(ValueError):
         queue.start_task("initialize")
Exemple #18
0
 def test_init(self):
     queue = OrderedTaskStatus()
     self.assertEqual('create', queue.task)
     self.assertEqual('idling', queue.status)
     self.assertListEqual(['create', 'initialize', 'update', 'finalize'],
                          queue.tasks)
Exemple #19
0
 def test_complete_task(self):
     queue = OrderedTaskStatus()
     queue.start_task("create")
     queue.complete_task()
     self.assertEqual("create", queue.task)
     self.assertEqual("created", queue.status)
Exemple #20
0
 def test_all_tasks(self):
     queue = OrderedTaskStatus()
     for task in queue.tasks:
         queue.start_task(task)
         queue.complete_task()
Exemple #21
0
 def test_complete_before_started(self):
     queue = OrderedTaskStatus()
     with self.assertRaises(ValueError):
         queue.complete_task()
Exemple #22
0
 def test_init(self):
     queue = OrderedTaskStatus()
     self.assertEqual("create", queue.task)
     self.assertEqual("idling", queue.status)
     self.assertListEqual(["create", "initialize", "update", "finalize"],
                          queue.tasks)
Exemple #23
0
 def test_start_task(self):
     queue = OrderedTaskStatus()
     queue.start_task('create')
     self.assertEqual('create', queue.task)
     self.assertEqual('creating', queue.status)