Opened 14 years ago

Closed 14 years ago

#13938 closed (invalid)

django.test.Client response has wrong request type

Reported by: Jari Pennanen Owned by: nobody
Component: Testing framework Version: 1.2
Severity: 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

Currently the django.test.Client gives out response objects that has request attribute, but the attribute is not HttpRequest, it is dict.

I'm trying to write tests for requests object (not the request data dict), I need for instance HttpRequest.get_full_path(). For my disappointment I noticed that Client can create the request objects but it truncates them to dicts at one point and places this to response.request.

I do not know what is wanted behavior but I'm now looking for a way to initialize HttpRequest manually for these tests, which probably is a better idea for this specific case anyway.

Change History (1)

comment:1 by Matthias Kestenholz, 14 years ago

Resolution: invalid
Status: newclosed

As you wrote initializing the request object directly is probably better.

This behavior (storing the data, not the object) is documented, I'm closing the ticket as invalid because of that:
http://docs.djangoproject.com/en/dev/topics/testing/#django.test.client.Response.request

Note: See TracTickets for help on using tickets.
Back to Top