Commit 12d23980 by Calen Pennington

Merge pull request #12628 from cpennington/test-i18n-reset-translations

Test i18n reset translations
parents 6b7a094d 105308e1
...@@ -66,7 +66,7 @@ class TestModuleI18nService(ModuleStoreTestCase): ...@@ -66,7 +66,7 @@ class TestModuleI18nService(ModuleStoreTestCase):
self.descriptor, self.descriptor,
self.field_data, self.field_data,
) )
self.addCleanup(translation.activate, settings.LANGUAGE_CODE) self.addCleanup(translation.deactivate)
def get_module_i18n_service(self, descriptor): def get_module_i18n_service(self, descriptor):
""" """
......
...@@ -9,6 +9,7 @@ from django.contrib.auth.models import User ...@@ -9,6 +9,7 @@ from django.contrib.auth.models import User
from django.core.urlresolvers import reverse, NoReverseMatch from django.core.urlresolvers import reverse, NoReverseMatch
from django.test import TestCase from django.test import TestCase
from django.test.client import Client from django.test.client import Client
from django.utils import translation
from dark_lang.models import DarkLangConfig from dark_lang.models import DarkLangConfig
from lang_pref import LANGUAGE_KEY from lang_pref import LANGUAGE_KEY
...@@ -21,6 +22,10 @@ class BaseI18nTestCase(TestCase): ...@@ -21,6 +22,10 @@ class BaseI18nTestCase(TestCase):
Base utilities for i18n test classes to derive from Base utilities for i18n test classes to derive from
""" """
def setUp(self):
super(BaseI18nTestCase, self).setUp()
self.addCleanup(translation.deactivate)
def assert_tag_has_attr(self, content, tag, attname, value): def assert_tag_has_attr(self, content, tag, attname, value):
"""Assert that a tag in `content` has a certain value in a certain attribute.""" """Assert that a tag in `content` has a certain value in a certain attribute."""
regex = r"""<{tag} [^>]*\b{attname}=['"]([\w\d\- ]+)['"][^>]*>""".format(tag=tag, attname=attname) regex = r"""<{tag} [^>]*\b{attname}=['"]([\w\d\- ]+)['"][^>]*>""".format(tag=tag, attname=attname)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment