Opened 5 years ago
Closed 5 years ago
#32470 closed Bug (fixed)
django.test.Client ignores request.urlconf when setting response.resolver_match
| Reported by: | Marc Gibbons | Owned by: | Marc Gibbons |
|---|---|---|---|
| Component: | Testing framework | Version: | dev |
| Severity: | Normal | Keywords: | test client, urlconf, middleware, resolver_match, request, response |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
This bug is present in versions 2.2+.
When request.urlconf is set by middleware, and points to a module other than the ROOT_URLCONF, the test client request will either:
a) Raise a Resolver404 if the path resolved is not part of the ROOT_URLCONF (even though the client has performed a successful request); or
b) Resolve the path from ROOT_URLCONF module instead of the one set on the request.urlconf attribute.
This occurs because the resolution of response.resolver_match only considers the request path.
Change History (3)
comment:1 by , 5 years ago
| Has patch: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 5 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
PR