Code

Opened 4 years ago

Closed 4 years ago

#13938 closed (invalid)

django.test.Client response has wrong request type

Reported by: Ciantic 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: UI/UX:

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.

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by mk

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.