예제 #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)
예제 #2
0
 def test_as_task(self):
     r = OperationView.as_task(TaskOperationMixin())
     self.assertEqual(len(r), 1)
예제 #3
0
 def setUp(self):
     self.operation = TaskOperationMixin()
예제 #4
0
 def get_operation(self, request):
     return [TaskOperationMixin() for _ in range(0, 3)]