Re: How to use URL namespaces in tests?
I've got the same problem any ideas ?
Le jeudi 23 août 2012 09:25:54 UTC+2, e.generalov a écrit :
Url patterns which provided by a django application should be addressed externally in the form of "namespace:name". I guess it will be connected to the project as follows:--
project/urls.pyurlpatterns = patterns('',URL patterns module in the application looks like:
url('^something/', include('django_something.urls', namespace='something')))
django_something/urls.pyurlpatterns = patterns('',
url('^$', show, name='show'))
and I write a test:
django_something/tests.pyclass ShowViewTest(TestCase):
urls = 'django_something.urls'
def test_should_render_something_template(self):
url = reverse('something:show') # !!!
response = self.client.get(url)
self.assertIn('something.html', set([t.name for t in response.templates]))
This test failes with exception "django NoReverseMatch 'something' is not a registered namespace" . How can I specify namespace 'something' in this case?
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/sbDyYDqLnzMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home