Exemplo n.º 1
0
    def test_serialize(self):
        task = Task(add_func, [1, 2])
        task_data = task.serialize()

        self.assertTrue(
            "[1, 2]" in task_data and "tests.utils.add_func" in task_data, msg="Error in task serialization"
        )

        task2 = Task(data={"key": 3})

        task2_data = task2.serialize()
        self.assertEqual(task2_data, '{"key": 3}', msg="Data couldn't be serialized")
Exemplo n.º 2
0
    def test_serialize(self):
        task = Task(add_func, [1, 2])
        task_data = task.serialize()

        self.assertTrue('[1, 2]' in task_data and "tests.utils.add_func" in task_data, msg="Error in task serialization")

        task2 = Task(data={
            "key": 3
        })

        task2_data = task2.serialize()
        self.assertEqual(task2_data, '{"key": 3}', msg="Data couldn't be serialized")
Exemplo n.º 3
0
    def test_unserialize_task(self):
        task = Task(add_func, [1, 2])
        task_data = task.serialize()

        task2 = Task.unserialize_task(task_data)
        self.assertEqual(task._fn, task2._fn)
        self.assertEqual(task._args, task2._args)
        self.assertEqual(task._kwargs, task2._kwargs)
Exemplo n.º 4
0
    def test_unserialize_task(self):
        task = Task(add_func, [1, 2])
        task_data = task.serialize()

        task2 = Task.unserialize_task(task_data)
        self.assertEqual(task._fn, task2._fn)
        self.assertEqual(task._args, task2._args)
        self.assertEqual(task._kwargs, task2._kwargs)