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