#16087: Add ResolverMatch object to test client responses.
-------------------------------------+-------------------------------------
Reporter: mrmachine | Owner: nobody
Type: Bug | Status: new
Milestone: 1.4 | Component: Testing framework
Version: 1.3 | Severity: Normal
Resolution: | Keywords: test client view
Triage Stage: Design | url resolve reverse
decision needed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
-------------------------------------+-------------------------------------
Comment (by mrmachine):
`assertRedirects` tells me the URLs that were used in a chain of
redirects. It does not tell me the view (function or named URL) that was
executed for a given request. Unless I'm reading the docs wrong (in which
case this should be a doc fix), one of the goals of the test client is to
allow users to verify the view that was executed for a given request.
What I want to test is, what view function or named URL was executed to
generate the response for a given request. Not was an object created in
the database (and it may not always be), then perform a redundant URL
lookup (Django already did it when processing the request) so I can
finally test if the correct view function or named URL was executed.
It would be a lot easier to write and read tests (and DRY) to simply POST
your data to a URL, and verify the view function or named URL that
generated the response. Django works some magic to make available a list
of templatest that were used, the context, etc. Why not make the
ResolverMatch object available, too?
I had a +1 on making this possible from cramm on IRC. I'm happy to take a
crack at implementing this functionality OR writing a doc patch if that
ends up being the decision. I just don't want to work on a fix if the core
devs don't want it.
--
Ticket URL: <https://code.djangoproject.com/ticket/16087#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.