Closed xiaowl closed 10 years ago
You are totally right, and your patch looks good.
I think the test_post_xxx/test_get_xxx got degraded a bit in v1.2 (had some refactoring done). It needs fixing.
I think I should just kill this raw crap and instead always return the regular response. Caller will just have to do .json() when they want it.
Would you like to submit a pull request? :)
Of cause, I'd like to. I will patch the mocked_response
and fix the broken tests.
According to the documentation, deletion API will return a "empty 204 response", thus without
raw=True
,response.json()
fromclient._request
raises exception.The
delete_folder
API does issue araw=True
request, butdelete_file
doesn't.I'd like to fix this, actually I've cloned this repo. But I want to do more. So I look into the test cases, found that
mocked_response
might "mocked" too much, I mean it just assume we always can get a valid response from the API server, when there is no content available, we assumeNone
returned. But that's not the real case. Empty content is not accepted by both json or simplejson.So I patched a little
Of cause some cases are broken, and some of them should be. But some broken ones like
I just don't get why we need these cases, which issuing non-exist API path "foo". It won't be hard to just look through the source code and patch
raw=True
if needed, but I think we better make these test cases more robust.Which way should we take to fix this problem? Simply add
raw=True
?