#35397: override_settings for STORAGES loses OPTIONS
-------------------------------------+-------------------------------------
     Reporter:  Will Giddens         |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  closed
    Component:  File                 |                  Version:  4.2
  uploads/storage                    |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  override_settings,   |             Triage Stage:
  storages                           |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

 * resolution:   => invalid
 * status:  new => closed

Comment:

 > I can provide a test case with the built-in storage engines if it helps.

 Please do as this is working for me on main:

 {{{#!diff
 diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
 index 420314573d..4e54968c11 100644
 --- a/tests/file_storage/tests.py
 +++ b/tests/file_storage/tests.py
 @@ -567,6 +567,25 @@ class FileStorageTests(SimpleTestCase):
                  settings["FILE_UPLOAD_DIRECTORY_PERMISSIONS"],
              )

 +    @override_settings(
 +        STORAGES={
 +            DEFAULT_STORAGE_ALIAS: {
 +                "BACKEND": "django.core.files.storage.InMemoryStorage",
 +                "OPTIONS": {
 +                    "location": "explicit_location",
 +                    "base_url": "explicit_base_url/",
 +                    "file_permissions_mode": 0o666,
 +                    "directory_permissions_mode": 0o666,
 +                },
 +            },
 +        }
 +    )
 +    def test_override_settings(self):
 +        self.assertEqual(default_storage._location, "explicit_location")
 +        self.assertEqual(default_storage._base_url, "explicit_base_url/")
 +        self.assertEqual(default_storage._file_permissions_mode, 0o666)
 +        self.assertEqual(default_storage._directory_permissions_mode,
 0o666)
 +
      def test_file_methods_pathlib_path(self):
          p = Path("test.file")
          self.assertFalse(self.storage.exists(p))
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35397#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018f0b66a4f8-d226c1ca-eca0-41af-a9f7-28b335f78e22-000000%40eu-central-1.amazonses.com.

Reply via email to