fix: update resolve_storage_backend function and fix tests

This commit is contained in:
Daniel Wong
2025-06-17 12:17:56 -06:00
parent 792a955e73
commit f114399e12
6 changed files with 6 additions and 7 deletions

View File

@@ -308,7 +308,6 @@ class ContentStoreImportTest(ModuleStoreTestCase):
@override_settings()
def test_resolve_storage_with_no_config(self):
""" If no storage setup is defined, we get FileSystemStorage by default """
del settings.DEFAULT_FILE_STORAGE
del settings.COURSE_IMPORT_EXPORT_STORAGE
del settings.COURSE_IMPORT_EXPORT_BUCKET
storage = resolve_storage_backend(

View File

@@ -84,7 +84,6 @@ class TestExportCourseMetadata(SharedModuleStoreTestCase):
@override_settings()
def test_resolve_storage_with_no_config(self):
""" If no storage setup is defined, we get FileSystemStorage by default """
del settings.DEFAULT_FILE_STORAGE
del settings.COURSE_METADATA_EXPORT_STORAGE
del settings.COURSE_METADATA_EXPORT_BUCKET
storage = resolve_storage_backend(

View File

@@ -914,7 +914,6 @@ class SoftwareSecurePhotoVerification(PhotoVerification):
config = settings.VERIFY_STUDENT["SOFTWARE_SECURE"]
# Default to the S3 backend for backward compatibility
storage_class = config.get("STORAGE_CLASS", "storages.backends.s3boto3.S3Boto3Storage")
storage_kwargs = config.get("STORAGE_KWARGS", {})
# Map old settings to the parameters expected by the storage backend
@@ -927,9 +926,9 @@ class SoftwareSecurePhotoVerification(PhotoVerification):
storage_kwargs["querystring_expire"] = self.IMAGE_LINK_DURATION
return resolve_storage_backend(
storage_key="software_secure",
legacy_setting_key="SOFTWARE_SECURE",
legacy_sec_setting_key="STORAGE_CLASS",
storage_key="verify_student",
legacy_setting_key="VERIFY_STUDENT",
legacy_sec_setting_keys=["STORAGE_CLASS"],
options=storage_kwargs
)

View File

@@ -47,6 +47,7 @@ iwIDAQAB
"CERT_VERIFICATION_PATH": False,
},
"DAYS_GOOD_FOR": 10,
"STORAGE_CLASS": "storages.backends.s3boto3.S3Boto3Storage"
}

View File

@@ -1301,6 +1301,7 @@ class TestSubmitPhotosForVerification(MockS3Boto3Mixin, TestVerificationBase):
"CERT_VERIFICATION_PATH": False,
},
"DAYS_GOOD_FOR": 10,
"STORAGE_CLASS": "storages.backends.s3boto3.S3Boto3Storage"
})
@httpretty.activate
def test_submit_photos_for_reverification(self):

View File

@@ -86,7 +86,7 @@ def _bs_model_storage():
return resolve_storage_backend(
storage_key="block_structures_settings",
legacy_setting_key="BLOCK_STRUCTURES_SETTINGS",
legacy_sec_setting_key="STORAGE_CLASS",
legacy_sec_setting_keys=["STORAGE_CLASS"],
options=storage_kwargs
)