예제 #1
0
class TaskOperationTest(TestCase):
    def setUp(self):
        self.operation = TaskOperationMixin()

    def tearDown(self):
        cache.clear()

    def test_save_to_mc(self):
        key = self.operation.get_key()
        self.assertIn(self.operation.__class__.__name__, key)
        self.assertIn(self.operation.__module__.split('.')[0], key)
        self.operation.save_to_mc(key)
        self.assertIsNotNone(cache.get(key))

    def test_execute_by_queue(self):
        r = self.operation.execute_by_queue('test')
        self.assertTrue(r)

    def test_execute_by_order(self):
        r = self.operation.execute_by_order()
        self.assertTrue(r)

    def test_execute_by_parallel(self):
        r = self.operation.execute_by_parallel()
        self.assertTrue(r)