How can I run unit tests to validate that a certain URL calls a particular function?
I want to do something like this:
class HomePageTest(TestCase):
def test_root_url_resolves_to_list_view(self):
found = resolve('/testme/')
self.assertEqual(found.func.func_name, ListView.__name__)
#self.assertEqual(found.func, ListView.as_view())
But lets imagine the apps urls.py is included in the projects urls.py under something like:
url(r'^submodule/$', include('fhqna.urls')),
How can I write the test included in the app so it checks the url "/testme/" indepent of how it is included? ("/submodule/testme/" in this example)?
Aucun commentaire:
Enregistrer un commentaire