def test_user_has_language_set_with_cookie(self): factory = RequestFactory() request = factory.get(self.page_en.get_navigation_url()) request.COOKIES[django_settings.LANGUAGE_COOKIE_NAME] = 'en' self.assertEqual(user_has_language_set(request), True)
def test_user_has_language_set_with_session(self): factory = RequestFactory() request = factory.get(self.page_en.get_navigation_url()) setattr(request, 'session', dict()) request.session[self.language_session_key] = 'en' self.assertEqual(user_has_language_set(request), True)