On Fri, Jun 13, 2008 at 11:28 PM, Chatchai Neanudorn
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> If you want to add functionalities to test client, you may need to modify
> (or subclass, if posible ) the client code (django.test.client.Client).

This will generally be a good approach, but it is not required in this case.

When you instantiate your test client instance, you can provide a
'defaults' dictionary which will provide additional settings for the
request environment. Every time the test client creates a request, it
will add the contents of the defaults dictionary into the request. In
this case, if you want your requests to have REMOTE_ADDR=localhost,
you invoke:

>>> myclient = Client(defaults={'REMOTE_ADDR':'localhost'})

All requests made using myclient will have REMOTE_ADDR in the request
environment (and thus the META block).

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to