def test_tasks_arguments_encoding_args(self):
        """The function positional args are properly encoded when using encode_function_args()."""
        task = Task()
        task.due_at = now()
        task.function_name = "tests.fixtures.do_nothing"
        task.encode_function_args(['a', 1, 'foo', True])
        task.save()

        expected = '{"__positional_args__": ["a", 1, "foo", true]}'
        self.assertEqual(task.function_args, expected)
    def test_tasks_arguments_encoding_kwargs(self):
        """The function kwargs are properly encoded when using encode_function_args()."""
        task = Task()
        task.due_at = now()
        task.function_name = "tests.fixtures.do_nothing"
        task.encode_function_args(kwargs={
            'cheese': 'blue',
            'fruits_count': 8
        })
        task.save()

        expected = '{"cheese": "blue", "fruits_count": 8}'
        self.assertEqual(task.function_args, expected)
    def test_tasks_arguments_encoding_mixed_args(self):
        """The function parameters are properly encoded when using encode_function_args()."""
        task = Task()
        task.due_at = now()
        task.function_name = "tests.fixtures.do_nothing"
        task.encode_function_args(
            ['a', 'b', 42],
            {
                'cheese': 'blue',
                'fruits_count': 2
            }
        )
        task.save()

        expected = '{"cheese": "blue", "fruits_count": 2, "__positional_args__": ["a", "b", 42]}'
        self.assertEqual(task.function_args, expected)