Dont let DarkLangConfig cache interfere with other tests

This commit is contained in:
Michael Youngstrom
2018-08-27 11:15:29 -04:00
parent 655d6abea8
commit bc1d883e1a
7 changed files with 14 additions and 13 deletions

View File

@@ -5,7 +5,6 @@ import urllib
import ddt
import mock
from config_models.models import cache
from django.conf import settings
from django.contrib.auth.models import User
from django.urls import reverse
@@ -16,19 +15,15 @@ from openedx.core.djangoapps.dark_lang.models import DarkLangConfig
from openedx.core.djangoapps.lang_pref.api import released_languages
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme_context
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from student.tests.factories import UserFactory
@ddt.ddt
class TestFooter(TestCase):
class TestFooter(CacheIsolationTestCase):
"""Test API end-point for retrieving the footer. """
shard = 4
def setUp(self):
"""Clear the configuration cache. """
super(TestFooter, self).setUp()
cache.clear()
@ddt.data("*/*", "text/html", "application/json")
def test_feature_flag(self, accepts):
self._set_feature_flag(False)

View File

@@ -41,6 +41,7 @@ from openedx.core.djangoapps.certificates.config import waffle
from openedx.core.djangoapps.dark_lang.models import DarkLangConfig
from openedx.core.lib.tests.assertions.events import assert_event_matches
from openedx.core.djangolib.js_utils import js_escaped_string
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from student.roles import CourseStaffRole
from student.tests.factories import CourseEnrollmentFactory, UserFactory
from track.tests import EventTrackingTestCase
@@ -241,7 +242,7 @@ class CommonCertificatesTestCase(ModuleStoreTestCase):
@ddt.ddt
class CertificatesViewsTests(CommonCertificatesTestCase):
class CertificatesViewsTests(CommonCertificatesTestCase, CacheIsolationTestCase):
"""
Tests for the certificates web/html views
"""

View File

@@ -14,11 +14,12 @@ from django.utils import translation
from openedx.core.djangoapps.dark_lang.models import DarkLangConfig
from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from openedx.core.lib.tests import attr
from student.tests.factories import UserFactory
class BaseI18nTestCase(TestCase):
class BaseI18nTestCase(CacheIsolationTestCase):
"""
Base utilities for i18n test classes to derive from
"""