def test_tasks_arguments_decoding_args(self): """The function positional args are properly decoded when using decode_function_args().""" task = Task() task.due_at = now() task.function_name = "tests.fixtures.do_nothing" task.function_args = '{"__positional_args__": [4, true, "banana"]}' task.save() expected = ([4, True, "banana"], {}) self.assertEqual(task.decode_function_args(), expected)
def test_tasks_arguments_decoding_mixed_args(self): """The function parameters are properly decoded when using decode_function_args().""" task = Task() task.due_at = now() task.function_name = "tests.fixtures.do_nothing" task.function_args = '{"cheese": "blue", "fruits_count": 8, "__positional_args__": [7, "orange"]}' task.save() expected = ([7, "orange"], { "cheese": "blue", "fruits_count": 8 }) self.assertEqual(task.decode_function_args(), expected)
def test_tasks_arguments_decoding_kwargs(self): """The function kwargs are properly decoded when using decode_function_args().""" task = Task() task.due_at = now() task.function_name = "tests.fixtures.do_nothing" task.function_args = '{"cheese": "blue", "fruits_count": 8}' task.save() expected = ([], { "cheese": "blue", "fruits_count": 8 }) self.assertEqual(task.decode_function_args(), expected)