Hi, i'm currently writing unit tests for an application where I need to change the language in the test client.
I tried using the "django.views.i18n.set_language" view within a test case like so: --- def setUp(self): self.client.post('/set_language/', data={'language': 'de'}) def tearDown(self): pass def test_registration(self): # This is just a duplicate to the above, to sanity check if this needs to be # called from within each test (unfortunately no..) self.client.post('/set_language/', data={'language': 'de'}) print "get_lang", get_language() -- The url "/set_language/" maps correctly to the "django.views.i18n.set_language" view, but the language printed in the test case after being set to 'de' is still 'en-us'. Can anybody help me here? My projects settings.py contains the following variables: --- LANGUAGE_CODE = 'de-de' # Languages for modeltranslations gettext = lambda s: s LANGUAGES = ( ('de', gettext('German')), ('en', gettext('English')), ) --- As "en-us" is nowhere used here I don't quite understand where the get_language() call is getting the value from. Regards, Peter Eschler --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---