django how to assert url pattern resolves to correct class based view function
问题 I have a class based view class HomePage(View): def get(self, request): return HttpResponse('<p>This is content.</p>') and url-pattern defined as below: urlpatterns = patterns('', url(r'^$', HomePage.as_view()), ) To this pattern resolves to current view function, I wrote a test like this: class HomePageTest(TestCase): def test_root_url_resolves_to_home_page_view(self): found = resolve('/') self.assertIsInstance(found.func, HomePage) By running this unittest I am getting following error: self