django-test-plus
django-test-plus copied to clipboard
Version 2.2.2 has breaking behaviour
When creating a unit test for a GET request, providing query parameters as data={"key": "value"}
, the latest version introduced a json.dumps on the dictionary, resulting in an error like:
`
def urlencode(query, doseq=False):
"""
A version of Python's urllib.parse.urlencode() function that can operate on
MultiValueDict and non-string values.
"""
if isinstance(query, MultiValueDict):
query = query.lists()
elif hasattr(query, 'items'):
query = query.items()
query_params = []
for key, value in query:
E ValueError: not enough values to unpack (expected 2, got 1)
venv/lib/python3.8/site-packages/django/utils/http.py:111: ValueError`
When pinning to version 2.2.1, this problem is no longer there.
It appears to be caused by the file test_plus/test.py:381
kwargs["data"] = json.dumps(data) if data is not None else None