-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for new Django 4.2 settings
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import django | ||
from django.test import override_settings | ||
import pytest | ||
from imagekit.conf import ImageKitConf, settings | ||
|
||
|
||
@pytest.mark.skipif( | ||
django.VERSION < (4, 2), | ||
reason="STORAGES was introduced in Django 4.2", | ||
) | ||
def test_custom_storages(): | ||
with override_settings( | ||
STORAGES={ | ||
"default": { | ||
"BACKEND": "tests.utils.CustomStorage", | ||
} | ||
}, | ||
): | ||
conf = ImageKitConf() | ||
assert conf.configure_default_file_storage(None) == "tests.utils.CustomStorage" | ||
|
||
|
||
@pytest.mark.skipif( | ||
django.VERSION >= (5, 1), | ||
reason="DEFAULT_FILE_STORAGE is removed in Django 5.1.", | ||
) | ||
def test_custom_default_file_storage(): | ||
with override_settings(DEFAULT_FILE_STORAGE="tests.utils.CustomStorage"): | ||
# If we don’t remove this, Django 4.2 will keep the old value. | ||
del settings.STORAGES | ||
conf = ImageKitConf() | ||
assert conf.configure_default_file_storage(None) == "tests.utils.CustomStorage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters