﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16087	Add ResolverMatch object to test client responses.	Tai Lee	Greg Chapple	"The docs say that you can use the test client to ""Test that the correct view is executed for a given URL."" but this doesn't seem to be possible without requiring users to perform their own `resolve()`, when Django has already done it and discarded the resulting ResolverMatch object.

{{{
response = client.post(some_url, some_data, follow=True)
self.assertEqual(resolve(response.request[""PATH_INFO""]).url_name, 'some_url')
}}}

In my case, `some_url` is a view that processes some form data and redirects according to the data, and I'm testing that with `some_data` as input, the request is redirected to `some_url`. With different data, it might redirect to a different URL.

Initially I tried to use `assertRedirects` and `response.redirect_chain` to test this, but ran into trouble because I had to try and construct a URL string that would match the redirect_chain from the view function or URL name, without knowing the exact URL arguments that were used to generate the redirect URL (auto field and a hash that is unique to the newly created object).

I'd like to see Django add the ResolverMatch object directly to all test client responses, so that users can easily test that a specific view function or named URL was executed.

I guess this would be implemented similarly to the way the context and templates are added.

I think this is either a feature bug or a documentation bug. If this is not a valid feature of the test client, the docs should be clarified. I read ""correct view is executed"" to mean ""correct view function (or class based view) is executed"".
"	Bug	closed	Testing framework	1.3	Normal	fixed	test client view url resolve reverse		Accepted	1	0	0	0	0	0
