mardi 13 septembre 2016

django-webtest throwing an error with i18n_patterns URLs

Here's my code:

from django.conf import settings
from django_webtest import WebTest


    class HomeFunctionalTests(WebTest):
        fixtures = ('languages',)

        def test_root_redirection(self):
            """
            When visiting domain.ext/ the user must be redirected to domain.ext/en/
            """

            page = self.app.get(settings.SITE_URL)

Error:

======================================================================
ERROR: test_root_redirection (myproj.tests.HomeFunctionalTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/adam/.pyvenv/myproj/lib/python3.5/site-packages/django/core/handlers/base.py", line 134, in get_response
    resolver_match = resolver.resolve(request.path_info)
  File "/Users/adam/.pyvenv/myproj/lib/python3.5/site-packages/django/core/urlresolvers.py", line 404, in resolve
    raise Resolver404({'tried': tried, 'path': new_path})
django.core.urlresolvers.Resolver404: {'path': '', 'tried': [[<RegexURLResolver <RegexURLPattern list> (admin:admin) ^darkroom/>], [<RegexURLResolver <module 'rest_framework.urls' from '/Users/adam/.pyvenv/myproj/lib/python3.5/site-packages/rest_framework/urls.py'> (rest_framework:rest_framework) ^api-auth/>], [<RegexURLResolver <RegexURLPattern list> (None:None) ^api/>], [<RegexURLPattern None ^api/tokens/>], [<RegexURLPattern documentation ^documentation/items/(?P<cat_slug>[\w-]+)/$>], [<RegexURLPattern None ^robots.txt$>], [<RegexURLPattern None ^design/400/$>], [<RegexURLPattern None ^design/403/$>], [<RegexURLPattern None ^design/404/$>], [<RegexURLPattern None ^design/500/$>], [<RegexURLPattern None ^(?P<cat>(name|namen|nombres|noms|nomes))>], [<LocaleRegexURLResolver <RegexURLPattern list> (None:None) ^en/>]]}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/adam/.pyvenv/myproj/lib/python3.5/site-packages/django/core/handlers/base.py", line 92, in get_exception_response
    response = callback(request, **dict(param_dict, exception=exception))
TypeError: page_not_found() got an unexpected keyword argument 'exception'

During handling of the above exception, another exception occurred:

The website works via the browser correctly.

Aucun commentaire:

Enregistrer un commentaire