Friday, March 9, 2012

Default language and Testing

Having a particularly weird problem to track down related to
internationalization, and RequestFactory vs. TestClient for testing
views.

If I run:

./manage.py test

All tests pass successfully. If I run:

./manage.py test <appname>

The app's tests will fail, throwing a template rendering exception for
templates that use the language code because the language django
thinks the request is asking for is not a language we've listed in
settings.LANGUAGES. (In this case it has always been 'en-us')

This problem will not occur if django's TestClient is used to make a
request to a url that calls a particular view. However if that same
view is simply called with the result of RequestFactory's get or put
methods, it will throw the error above.

It appears as though when using the RequestFactory method, the
settings file is not being respected. Am I missing something simple
here?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
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


Real Estate