From 4943674fc1f1b51a7eb76788a2a469a3dc77f360 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Thu, 21 Sep 2023 16:56:50 +0500 Subject: [PATCH] feat!: upgrading `django-storages` to `1.13.2` (#33301) * feat!: upgrading `django-storages` to `1.13.2` --- .../contentstore/tests/test_video_utils.py | 22 ++++++++++++++----- lms/envs/production.py | 1 + requirements/constraints.txt | 4 ++-- requirements/edx/base.txt | 2 +- requirements/edx/development.txt | 2 +- requirements/edx/doc.txt | 2 +- requirements/edx/testing.txt | 2 +- 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_video_utils.py b/cms/djangoapps/contentstore/tests/test_video_utils.py index 5ba7384dba2b..80d55b92b81d 100644 --- a/cms/djangoapps/contentstore/tests/test_video_utils.py +++ b/cms/djangoapps/contentstore/tests/test_video_utils.py @@ -378,6 +378,15 @@ def setUp(self): self.storage = S3Boto3Storage() self.storage._connections.connection = MagicMock() # pylint: disable=protected-access + def order_dict(self, dictionary): + """ + sorting dict key:values for tests cases. + """ + sorted_key_values = sorted(dictionary.items()) + dictionary.clear() + dictionary.update(sorted_key_values) + return dictionary + def test_video_backend(self): self.assertEqual( S3Boto3Storage, @@ -416,9 +425,10 @@ def test_storage_without_global_default_acl_setting(self): obj = storage.bucket.Object.return_value obj.upload_fileobj.assert_called_with( content, - ExtraArgs={ + ExtraArgs=self.order_dict({ 'ContentType': 'text/plain', - } + }), + Config=storage._transfer_config # pylint: disable=protected-access ) @override_settings(AWS_DEFAULT_ACL='public-read') @@ -452,7 +462,8 @@ def test_storage_without_global_default_acl_setting_and_bucket_acls(self, defaul obj.upload_fileobj.assert_called_with( content, - ExtraArgs=ExtraArgs + ExtraArgs=self.order_dict(ExtraArgs), + Config=storage._transfer_config # pylint: disable=protected-access ) @ddt.data('public-read', 'private') @@ -473,7 +484,8 @@ def test_storage_passing_default_acl_as_none(self, input_acl): obj = storage.bucket.Object.return_value obj.upload_fileobj.assert_called_with( content, - ExtraArgs={ + ExtraArgs=self.order_dict({ 'ContentType': 'text/plain', - } + }), + Config=storage._transfer_config # pylint: disable=protected-access ) diff --git a/lms/envs/production.py b/lms/envs/production.py index 5c121461dad5..0924c85e1ef9 100644 --- a/lms/envs/production.py +++ b/lms/envs/production.py @@ -477,6 +477,7 @@ def get_env_setting(setting): else: DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' + # If there is a database called 'read_replica', you can use the use_read_replica_if_available # function in util/query.py, which is useful for very large database reads DATABASES = AUTH_TOKENS.get('DATABASES', DATABASES) diff --git a/requirements/constraints.txt b/requirements/constraints.txt index b969ef48971b..f96e72bd0a97 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -21,7 +21,7 @@ celery>=5.2.2,<6.0.0 click>=8.0,<9.0 # django-storages version upgrade -django-storages==1.12.3 +django-storages==1.13.2 # The team that owns this package will manually bump this package rather than having it pulled in automatically. @@ -131,6 +131,6 @@ openedx-events<8.6.0 # Open edX Events from Hooks Extension Framew openedx-learning==0.1.6 # lti-consumer-xblock 9.6.2 contains a breaking change that makes -# existing custom parameter configurations unusable. +# existing custom parameter configurations unusable. # https://github.com/openedx/xblock-lti-consumer/issues/410 has been opened to track a fix lti-consumer-xblock==9.6.1 diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index a0ab1ac3835f..08658a809ccd 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -357,7 +357,7 @@ django-statici18n==2.4.0 # -r requirements/edx/kernel.in # lti-consumer-xblock # xblock-drag-and-drop-v2 -django-storages==1.12.3 +django-storages==1.13.2 # via # -c requirements/edx/../constraints.txt # -r requirements/edx/kernel.in diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 5a64157e4188..d28f1a72974a 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -571,7 +571,7 @@ django-statici18n==2.4.0 # -r requirements/edx/testing.txt # lti-consumer-xblock # xblock-drag-and-drop-v2 -django-storages==1.12.3 +django-storages==1.13.2 # via # -c requirements/edx/../constraints.txt # -r requirements/edx/doc.txt diff --git a/requirements/edx/doc.txt b/requirements/edx/doc.txt index 14b1e3338cb9..c2a4413c61a0 100644 --- a/requirements/edx/doc.txt +++ b/requirements/edx/doc.txt @@ -420,7 +420,7 @@ django-statici18n==2.4.0 # -r requirements/edx/base.txt # lti-consumer-xblock # xblock-drag-and-drop-v2 -django-storages==1.12.3 +django-storages==1.13.2 # via # -c requirements/edx/../constraints.txt # -r requirements/edx/base.txt diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 2ff054ff5062..a201d1d0f63f 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -453,7 +453,7 @@ django-statici18n==2.4.0 # -r requirements/edx/base.txt # lti-consumer-xblock # xblock-drag-and-drop-v2 -django-storages==1.12.3 +django-storages==1.13.2 # via # -c requirements/edx/../constraints.txt # -r requirements/edx/base.txt