feat: djang-cor-headers need schemes with urls. Adding condition to switch lists with different version.

With the PR it will load the old `CORS_ORIGIN_WHITELIST` since there is no change in `djang-cor-headers` version. In next PR this version will get upgraded.
This commit is contained in:
edX requirements bot
2021-08-31 15:40:38 +05:00
committed by Awais Qureshi
parent c2a299ef4f
commit 5e84e3761f
4 changed files with 33 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ from django.core.handlers.wsgi import WSGIRequest
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.timezone import now
from importlib_metadata import version
from rest_framework.test import APITestCase
from common.djangoapps.student.tests.factories import UserFactory
@@ -260,6 +261,11 @@ class ExperimentCrossDomainTests(APITestCase):
**kwargs
)
def test_white_list_contents_with_cors_header_version(self, *args): # pylint: disable=unused-argument
""" Verify that with django-cor-header<3 it loads list without scheme. """
assert settings.CORS_ORIGIN_WHITELIST == ['sandbox.edx.org']
assert int(version('django_cors_headers').split('.')[0]) == 2
class ExperimentKeyValueViewSetTests(APITestCase): # lint-amnesty, pylint: disable=missing-class-docstring