示例#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")
示例#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")
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#11
0
 def test_all_tasks(self):
     queue = OrderedTaskStatus()
     for task in queue.tasks:
         queue.start_task(task)
         queue.complete_task()
示例#12
0
 def test_complete_before_started(self):
     queue = OrderedTaskStatus()
     with self.assertRaises(ValueError):
         queue.complete_task()
示例#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)
示例#14
0
 def test_all_tasks(self):
     queue = OrderedTaskStatus()
     for task in queue.tasks:
         queue.start_task(task)
         queue.complete_task()
示例#15
0
 def test_complete_before_started(self):
     queue = OrderedTaskStatus()
     with self.assertRaises(ValueError):
         queue.complete_task()
示例#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)