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_start_completed_task(self):
        queue = OrderedTaskStatus()
        queue.start_task("create")
        queue.complete_task()

        with self.assertRaises(ValueError):
            queue.start_task("create")
Exemple #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
0
 def test_all_tasks(self):
     queue = OrderedTaskStatus()
     for task in queue.tasks:
         queue.start_task(task)
         queue.complete_task()
Exemple #12
0
 def test_complete_before_started(self):
     queue = OrderedTaskStatus()
     with self.assertRaises(ValueError):
         queue.complete_task()
Exemple #13
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 #14
0
 def test_all_tasks(self):
     queue = OrderedTaskStatus()
     for task in queue.tasks:
         queue.start_task(task)
         queue.complete_task()
Exemple #15
0
 def test_complete_before_started(self):
     queue = OrderedTaskStatus()
     with self.assertRaises(ValueError):
         queue.complete_task()
Exemple #16
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)