diff --git a/common/djangoapps/third_party_auth/management/commands/tests/test_saml.py b/common/djangoapps/third_party_auth/management/commands/tests/test_saml.py index 12fc96c2bd..9e809e2ac4 100644 --- a/common/djangoapps/third_party_auth/management/commands/tests/test_saml.py +++ b/common/djangoapps/third_party_auth/management/commands/tests/test_saml.py @@ -16,6 +16,7 @@ from django.utils.six import StringIO from requests import exceptions from requests.models import Response +from openedx.core.djangolib.testing.utils import CacheIsolationTestCase from third_party_auth.tests.factories import SAMLConfigurationFactory, SAMLProviderConfigFactory @@ -47,7 +48,7 @@ def mock_get(status_code=200): @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') -class TestSAMLCommand(TestCase): +class TestSAMLCommand(CacheIsolationTestCase): """ Test django management command for fetching saml metadata. """ diff --git a/common/djangoapps/third_party_auth/tests/testutil.py b/common/djangoapps/third_party_auth/tests/testutil.py index b613d26d64..71243551ea 100644 --- a/common/djangoapps/third_party_auth/tests/testutil.py +++ b/common/djangoapps/third_party_auth/tests/testutil.py @@ -17,6 +17,7 @@ from django.contrib.sites.models import Site from mako.template import Template from provider import constants from provider.oauth2.models import Client as OAuth2Client +from openedx.core.djangolib.testing.utils import CacheIsolationMixin from openedx.core.storage import OverwriteStorage from third_party_auth.models import ( @@ -188,7 +189,7 @@ class ThirdPartyAuthTestMixin(object): return f.read() -class TestCase(ThirdPartyAuthTestMixin, django.test.TestCase): +class TestCase(ThirdPartyAuthTestMixin, CacheIsolationMixin, django.test.TestCase): """Base class for auth test cases.""" def setUp(self): super(TestCase, self).setUp() diff --git a/openedx/core/djangoapps/catalog/tests/test_models.py b/openedx/core/djangoapps/catalog/tests/test_models.py index ff0231afcc..496d81f64f 100644 --- a/openedx/core/djangoapps/catalog/tests/test_models.py +++ b/openedx/core/djangoapps/catalog/tests/test_models.py @@ -2,19 +2,18 @@ import ddt -import mock + from django.test import TestCase, override_settings from openedx.core.djangoapps.catalog.tests import mixins from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration +from openedx.core.djangolib.testing.utils import CacheIsolationTestCase COURSE_CATALOG_API_URL = 'https://api.example.com/v1/' @ddt.ddt -# ConfigurationModels use the cache. Make every cache get a miss. -@mock.patch('config_models.models.cache.get', return_value=None) -class TestCatalogIntegration(mixins.CatalogIntegrationMixin, TestCase): +class TestCatalogIntegration(mixins.CatalogIntegrationMixin, CacheIsolationTestCase): """Tests covering the CatalogIntegration model.""" def assert_get_internal_api_url_value(self, expected): @@ -27,13 +26,13 @@ class TestCatalogIntegration(mixins.CatalogIntegrationMixin, TestCase): (1, True), ) @ddt.unpack - def test_cache_control(self, cache_ttl, is_cache_enabled, _mock_cache): + def test_cache_control(self, cache_ttl, is_cache_enabled): """Test the behavior of the property controlling whether API responses are cached.""" catalog_integration = self.create_catalog_integration(cache_ttl=cache_ttl) self.assertEqual(catalog_integration.is_cache_enabled, is_cache_enabled) @override_settings(COURSE_CATALOG_API_URL=COURSE_CATALOG_API_URL) - def test_get_internal_api_url(self, _mock_cache): + def test_get_internal_api_url(self): """ Requests made without a microsite should return the value from settings. """ self.assert_get_internal_api_url_value(COURSE_CATALOG_API_URL) catalog_integration = self.create_catalog_integration() @@ -41,14 +40,14 @@ class TestCatalogIntegration(mixins.CatalogIntegrationMixin, TestCase): @override_settings(COURSE_CATALOG_API_URL=COURSE_CATALOG_API_URL) @with_site_configuration(configuration={}) - def test_get_internal_api_url_without_microsite_override(self, _mock_cache): + def test_get_internal_api_url_without_microsite_override(self): """ Requests made to microsites that do not have COURSE_CATALOG_API_URL overridden should return the default value from settings. """ self.assert_get_internal_api_url_value(COURSE_CATALOG_API_URL) @override_settings(COURSE_CATALOG_API_URL=COURSE_CATALOG_API_URL) @with_site_configuration(configuration={'COURSE_CATALOG_API_URL': 'foo'}) - def test_get_internal_api_url_with_microsite_override(self, _mock_cache): + def test_get_internal_api_url_with_microsite_override(self): """ If a microsite has overridden the value of COURSE_CATALOG_API_URL, the overridden value should be returned. """ self.assert_get_internal_api_url_value('foo') diff --git a/openedx/core/djangoapps/catalog/tests/test_utils.py b/openedx/core/djangoapps/catalog/tests/test_utils.py index e08a3b4ee7..ce65058301 100644 --- a/openedx/core/djangoapps/catalog/tests/test_utils.py +++ b/openedx/core/djangoapps/catalog/tests/test_utils.py @@ -439,7 +439,7 @@ class TestGetLocalizedPriceText(TestCase): @skip_unless_lms @mock.patch(UTILS_MODULE + '.get_edx_api_data') -class TestGetCourseRuns(CatalogIntegrationMixin, TestCase): +class TestGetCourseRuns(CatalogIntegrationMixin, CacheIsolationTestCase): """ Tests covering retrieval of course runs from the catalog service. """ @@ -474,6 +474,7 @@ class TestGetCourseRuns(CatalogIntegrationMixin, TestCase): Verify that no errors occur when catalog config is missing. """ CatalogIntegration.objects.all().delete() + self.clear_caches() data = get_course_runs() self.assertFalse(mock_get_edx_api_data.called) diff --git a/requirements/edx-sandbox/py35.txt b/requirements/edx-sandbox/py35.txt index fe6fc5416e..1819bc3672 100644 --- a/requirements/edx-sandbox/py35.txt +++ b/requirements/edx-sandbox/py35.txt @@ -7,7 +7,7 @@ common/lib/sandbox-packages common/lib/symmath git+https://github.com/edx/openedx-calc.git@e9b698c85ad1152002bc0868f475f153dce88952#egg=calc==0.4 -cffi==1.13.2 +cffi==1.14.0 git+https://github.com/edx/openedx-chem.git@ff4e3a03d3c7610e47a9af08eb648d8aabe2eb18#egg=chem==1.0.0 cryptography==2.8 cycler==0.10.0 # via matplotlib diff --git a/requirements/edx-sandbox/shared.txt b/requirements/edx-sandbox/shared.txt index cdb9e685ab..a1ca5c8827 100644 --- a/requirements/edx-sandbox/shared.txt +++ b/requirements/edx-sandbox/shared.txt @@ -4,7 +4,7 @@ # # make upgrade # -cffi==1.13.2 # via cryptography +cffi==1.14.0 # via cryptography cryptography==2.8 lxml==4.5.0 nltk==3.4.5 diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index c0d43c7951..cc15cfb637 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -38,7 +38,7 @@ git+https://github.com/edx/bridgekeeper.git@2423e8d8788c2132ebeec509e1a7b17e1f5b git+https://github.com/edx/openedx-calc.git@e9b698c85ad1152002bc0868f475f153dce88952#egg=calc==0.4 celery==3.1.25 certifi==2019.11.28 -cffi==1.13.2 +cffi==1.14.0 chardet==3.0.4 git+https://github.com/edx/openedx-chem.git@ff4e3a03d3c7610e47a9af08eb648d8aabe2eb18#egg=chem==1.0.0 click==7.0 # via code-annotations, user-util @@ -57,7 +57,7 @@ django-babel-underscore==0.5.2 django-babel==0.6.2 # via django-babel-underscore git+https://github.com/edx/django-celery.git@756cb57aad765cb2b0d37372c1855b8f5f37e6b0#egg=django-celery==3.2.1+edx.2 django-classy-tags==1.0.0 # via django-sekizai -django-config-models==1.0.4 +django-config-models==2.0.0 django-cors-headers==2.5.3 django-countries==5.5 django-crum==0.7.5 diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index d4709294ee..320d26820e 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -42,7 +42,7 @@ git+https://github.com/edx/bridgekeeper.git@2423e8d8788c2132ebeec509e1a7b17e1f5b git+https://github.com/edx/openedx-calc.git@e9b698c85ad1152002bc0868f475f153dce88952#egg=calc==0.4 celery==3.1.25 certifi==2019.11.28 -cffi==1.13.2 +cffi==1.14.0 chardet==3.0.4 git+https://github.com/edx/openedx-chem.git@ff4e3a03d3c7610e47a9af08eb648d8aabe2eb18#egg=chem==1.0.0 click-log==0.3.2 @@ -67,7 +67,7 @@ django-babel-underscore==0.5.2 django-babel==0.6.2 git+https://github.com/edx/django-celery.git@756cb57aad765cb2b0d37372c1855b8f5f37e6b0#egg=django-celery==3.2.1+edx.2 django-classy-tags==1.0.0 -django-config-models==1.0.4 +django-config-models==2.0.0 django-cors-headers==2.5.3 django-countries==5.5 django-crum==0.7.5 diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index d2802bc25a..ff9291921f 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -41,7 +41,7 @@ git+https://github.com/edx/bridgekeeper.git@2423e8d8788c2132ebeec509e1a7b17e1f5b git+https://github.com/edx/openedx-calc.git@e9b698c85ad1152002bc0868f475f153dce88952#egg=calc==0.4 celery==3.1.25 certifi==2019.11.28 -cffi==1.13.2 +cffi==1.14.0 chardet==3.0.4 git+https://github.com/edx/openedx-chem.git@ff4e3a03d3c7610e47a9af08eb648d8aabe2eb18#egg=chem==1.0.0 click-log==0.3.2 # via edx-lint @@ -66,7 +66,7 @@ django-babel-underscore==0.5.2 django-babel==0.6.2 git+https://github.com/edx/django-celery.git@756cb57aad765cb2b0d37372c1855b8f5f37e6b0#egg=django-celery==3.2.1+edx.2 django-classy-tags==1.0.0 -django-config-models==1.0.4 +django-config-models==2.0.0 django-cors-headers==2.5.3 django-countries==5.5 django-crum==0.7.5