# vim:ai:et:ff=unix:fileencoding=utf-8:sw=4:ts=4:

from __future__ import (absolute_import, print_function, unicode_literals)

try:
    import unittest2 as unittest
except:
    import unittest

class Recipe(object):
    pass

class Dispatcher(object):
    def start(self):
        raise NotImplementedError

    def build(self, recipe, *things):
        raise NotImplementedError

class Job(object):
    def is_complete(self):
        raise NotImplementedError

    def is_successful(self):
        raise NotImplementedError

    def wait(self, timeout):
        raise NotImplementedError

class Task(object):
    pass

class SequenceTask(Task):
    pass

class ToolpathTask(Task):
    pass

class PrintTask(Task):
    pass

class DispatcherTestCase(unittest.TestCase):
    def _create_conveyor(self):
        conveyor = self._create_conveyor_celery()
        conveyor.start()
        return conveyor

    def _create_conveyor_celery(self):
        import conveyor.celery
        conveyor = conveyor.celery.CeleryDispatcher()
        return conveyor

    def _wait_for_success(self, job, timeout):
        job.wait(timeout)
        self.assertTrue(job.is_complete())
        self.assertTrue(job.is_successful())

    @unittest.skip('totally unimplemented')
    def test_single(self):
        recipe = None
        conveyor = self._create_conveyor()
        thing = {'surface': 'single.stl', 'material': 'blue',
            'extruder': 'left'}
        job = conveyor.build(recipe, thing)
        self._wait_for_success(job, 60.0)

    @unittest.skip('totally unimplemented')
    def test_dual(self):
        recipe = None
        conveyor = self._create_conveyor()
        left = {'surface': 'left.stl', 'material': 'blue',
            'extruder': 'left'}
        right = {'surface': 'right.stl', 'material': 'red',
            'extruder': 'right'}
        job = conveyor.build(recipe, left, right)
        self._wait_for_success(job, 60.0)

@@ -123,1818 +123,4 @@
 ls)%0A
-%0Atry:%0A    import unittest2 as unittest%0Aexcept:%0A    import unittest%0A%0Aclass Recipe(object):%0A    pass%0A%0Aclass Dispatcher(object):%0A    def start(self):%0A        raise NotImplementedError%0A%0A    def build(self, recipe, *things):%0A        raise NotImplementedError%0A%0Aclass Job(object):%0A    def is_complete(self):%0A        raise NotImplementedError%0A%0A    def is_successful(self):%0A        raise NotImplementedError%0A%0A    def wait(self, timeout):%0A        raise NotImplementedError%0A%0Aclass Task(object):%0A    pass%0A%0Aclass SequenceTask(Task):%0A    pass%0A%0Aclass ToolpathTask(Task):%0A    pass%0A%0Aclass PrintTask(Task):%0A    pass%0A%0Aclass DispatcherTestCase(unittest.TestCase):%0A    def _create_conveyor(self):%0A        conveyor = self._create_conveyor_celery()%0A        conveyor.start()%0A        return conveyor%0A%0A    def _create_conveyor_celery(self):%0A        import conveyor.celery%0A        conveyor = conveyor.celery.CeleryDispatcher()%0A        return conveyor%0A%0A    def _wait_for_success(self, job, timeout):%0A        job.wait(timeout)%0A        self.assertTrue(job.is_complete())%0A        self.assertTrue(job.is_successful())%0A%0A    @unittest.skip('totally unimplemented')%0A    def test_single(self):%0A        recipe = None%0A        conveyor = self._create_conveyor()%0A        thing = %7B'surface': 'single.stl', 'material': 'blue',%0A            'extruder': 'left'%7D%0A        job = conveyor.build(recipe, thing)%0A        self._wait_for_success(job, 60.0)%0A%0A    @unittest.skip('totally unimplemented')%0A    def test_dual(self):%0A        recipe = None%0A        conveyor = self._create_conveyor()%0A        left = %7B'surface': 'left.stl', 'material': 'blue',%0A            'extruder': 'left'%7D%0A        right = %7B'surface': 'right.stl', 'material': 'red',%0A            'extruder': 'right'%7D%0A        job = conveyor.build(recipe, left, right)%0A        self._wait_for_success(job, 60.0)%0A

Remove unused junk.