Client.raw_post

5 views
Skip to first unread message

Afternoon

unread,
Dec 18, 2006, 10:55:09 AM12/18/06
to Django developers
A little while ago there was a discussion[1] about test cases that post
raw data such as XML or JSON to a view. Russ suggested adding a
raw_post method to the test Client to facilitate such tests. I've
created a ticket and uploaded a patch that does just this.

http://code.djangoproject.com/ticket/3160

I've assigned it to Russ, as he suggested it originally.

Ben


[1]
http://groups.google.com/group/django-developers/browse_thread/thread/273dec9b25569216/d16994bdadf127e8

Russell Keith-Magee

unread,
Dec 19, 2006, 9:29:33 PM12/19/06
to django-d...@googlegroups.com
On 12/18/06, Afternoon <afte...@uk2.net> wrote:
>
> A little while ago there was a discussion[1] about test cases that post
> raw data such as XML or JSON to a view. Russ suggested adding a
> raw_post method to the test Client to facilitate such tests. I've
> created a ticket and uploaded a patch that does just this.
>
> http://code.djangoproject.com/ticket/3160
>
> I've assigned it to Russ, as he suggested it originally.

Looks good, but:

1) Needs a test case. (tests/modeltests/test_client)

2) Needs documentation, or at least a first pass draft (docs/testing.txt)

3) What's the intention with defaulting to
application/x-www-url-encoded as a content type? I agree that type
should be an argument to the raw_post method; however, unless you can
advocate why application/x-www-url-encoded is the value that will be
used 90% of the time for this argument, I'd rather keep it as a
required but without default. If the objection is to typing
application/... all the time, perhaps some constants in the Client
package would be a better approach (Client.URL_ENCODED =
'application/...').

Yours,
Russ Magee %-)

Afternoon

unread,
Jan 21, 2007, 9:32:23 AM1/21/07
to Django developers
OK, I've added tests and documentation to the patch and removed the
default for the type argument to raw_post. All tests pass with this
patch applied to the current Django SVN version. Please let me know if
any more changes are needed.

Ben

Reply all
Reply to author
Forward
0 new messages