7
7
from django .core .cache import caches
8
8
from django .core .management import call_command
9
9
from django .template .loader import render_to_string
10
- from django .test import override_settings
11
10
12
11
import sri
13
12
from sri .algorithm import DEFAULT_ALGORITHM
@@ -140,17 +139,16 @@ def test_uses_default_cache():
140
139
assert sri .utils .get_cache () == caches ["default" ]
141
140
142
141
143
- @ override_settings (
144
- CACHES = { "sri" : { "BACKEND" : "django.core.cache.backends.dummy.DummyCache" }}
145
- )
146
- def test_uses_dedicated_cache ():
142
+ def test_uses_dedicated_cache ( settings ):
143
+ settings . CACHES = {
144
+ "sri" : { "BACKEND" : "django.core.cache.backends.dummy.DummyCache" }
145
+ }
147
146
assert sri .utils .get_cache () == caches ["sri" ]
148
147
149
148
150
149
@pytest .mark .parametrize ("algorithm" , sri .Algorithm )
151
150
@pytest .mark .parametrize ("file" , TEST_FILES )
152
151
def test_caches_hash (algorithm , file ):
153
-
154
152
file_path = sri .utils .get_static_path (file )
155
153
cache_key = sri .hashers .get_cache_key (file_path , algorithm )
156
154
cache = sri .utils .get_cache ()
@@ -160,11 +158,13 @@ def test_caches_hash(algorithm, file):
160
158
assert cache .get (cache_key ) == digest
161
159
162
160
163
- @override_settings (
164
- STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
165
- )
166
161
@pytest .mark .parametrize ("file" , TEST_FILES )
167
- def test_manifest_storage (file ):
162
+ def test_manifest_storage (settings , file ):
163
+ settings .STORAGES = {
164
+ "staticfiles" : {
165
+ "BACKEND" : "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
166
+ }
167
+ }
168
168
call_command ("collectstatic" , interactive = False , clear = True , verbosity = 0 )
169
169
170
170
file_path = sri .utils .get_static_path (file )
@@ -177,9 +177,6 @@ def test_manifest_storage(file):
177
177
assert str (file_path ).endswith (staticfiles_storage .stored_name (file ))
178
178
179
179
180
- @override_settings (
181
- STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
182
- )
183
180
@pytest .mark .parametrize ("file" , TEST_FILES )
184
181
def test_default_storage (file ):
185
182
# Test for issue #70
0 commit comments