Opened 12 years ago
Closed 12 years ago
#19797 closed Bug (duplicate)
Test client does not handle data well
Reported by: | FunkyBob | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When trying to pass an arbitrary request body using self.client.delete(), it does not handle the data the same as using get/post.
result = self.client.delete(...,
data = json.dumps({'key': 'value'}),
content_type='application/json',
)
Results in:
File ".../lib/python2.7/site-packages/django/test/client.py", line 486, in delete
response = super(Client, self).delete(path, data=data, extra)
File ".../lib/python2.7/site-packages/django/test/client.py", line 313, in delete
'QUERY_STRING': urlencode(data, doseq=True) or parsed[4],
File ".../local/lib/python2.7/site-packages/django/utils/http.py", line 75, in urlencode
for k, v in query],
ValueError: need more than 1 value to unpack
Whereas the same call using client.get or client.post will pass the data on unmolested when content-type is set the same.
Change History (2)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Closing as a duplicate of #17371. Please reopen if you encounter the problem in master.
I think I fixed that a few months ago.
Can you try with 1.5rc1 or master?