#10747: django.contrib.auth logout test fails after [10332]
-------------------------------------------------------+--------------------
Reporter: Matthew Flanagan <[email protected]> | Owner: nobody
Status: new | Milestone: 1.1
Component: Authentication | Version:
1.1-beta-1
Keywords: | Stage:
Unreviewed
Has_patch: 1 |
-------------------------------------------------------+--------------------
The test_logout_default fails for me when I run my projects test suite. I
have django.contrib.auth in my INSTALLED_APPS. The traceback is (note this
is a red-herring):
{{{
======================================================================
ERROR: Logout without next_page option renders the default template
----------------------------------------------------------------------
Traceback (most recent call last):
File "/xxx/django/django/contrib/auth/tests/views.py", line 208, in
test_logout_default
response = self.client.get('/logout_test/')
File "/xxx/django/django/test/client.py", line 280, in get
response = self.request(**r)
File "/xxx/vendor/django/django/test/client.py", line 224, in request
response = self.handler(environ)
File "/xxx/vendor/django/django/test/client.py", line 68, in __call__
response = self.get_response(request)
File "/xxx/vendor/django/django/core/handlers/base.py", line 122, in
get_response
return self.handle_uncaught_exception(request, resolver,
sys.exc_info())
File "/xxx/nong/vendor/django/django/core/handlers/base.py", line 165,
in handle_uncaught_exception
callback, param_dict = resolver.resolve500()
File "/xxx/vendor/django/django/core/urlresolvers.py", line 229, in
resolve500
return self._resolve_special('500')
File "/xxx/vendor/django/django/core/urlresolvers.py", line 218, in
_resolve_special
callback = getattr(self.urlconf_module, 'handler%s' % view_type)
AttributeError: 'module' object has no attribute 'handler500'
----------------------------------------------------------------------
}}}
Which template the logout view uses depends on your INSTALLED_APPS list
order and whether or not you have your own
{{{registration/logged_out.html}}}, which I do.
The traceback above is a red-herring because what is happening is that the
logout view is finding my project's {{{registration/logged_out.html}}}
template which has a few {{{{% url ... %}}}}'s in it but the test runner
is unable to resolve all those other urls thus causing a 500 error.
After investigating I discovered two things:
1. {{{django.contrib.auth.urls}}} has a {{{^logout/$}}} url regex and
django.contrib.auth.tests.urls imports {{{urlpatterns}}} from {{{
django.contrib.auth.urls }}} and appends to it a list of test URLs
including an identical {{{^logout/$}}} regex. If you renamed the latter to
{{{^logout_test/$}}} and update 2 tests to use it then you will be assured
that you are testing what you intended.
2. The test suite's {{{^logout_test/$}}} url should also define which
{{{template_name}}} it uses so it won't try to load any old
{{{registration/logged_out.html}}} and fail.
The patch attached fixes this.
--
Ticket URL: <http://code.djangoproject.com/ticket/10747>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---