resolver_match
An instance of ResolverMatch
for the response. You can use the func
attribute, for example, to verify the view that served the response:
# my_view here is a function based view self.assertEqual(response.resolver_match.func, my_view) # class-based views need to be compared by name, as the functions # generated by as_view() won't be equal self.assertEqual(response.resolver_match.func.__name__, MyView.as_view().__name__)
If the given URL is not found, accessing this attribute will raise a Resolver404
exception.
Please login to continue.