Skip to content

Commit 9c36bbe

Browse files
committed
Added testcase to check backward compatibility with missing INTEGRITY key
1 parent 09ea1c7 commit 9c36bbe

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/app/tests/test_webpack.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,29 @@ def test_integrity(self):
229229
result.rendered_content
230230
)
231231

232+
def test_integrity_missing_config(self):
233+
self.compile_bundles('webpack.config.integrity.js')
234+
235+
loader = get_loader(DEFAULT_CONFIG)
236+
# remove INTEGRITY from config completely to test backward compatibility
237+
integrity_from_config = loader.config.pop('INTEGRITY')
238+
239+
view = TemplateView.as_view(template_name='single.html')
240+
request = self.factory.get('/')
241+
result = view(request)
242+
243+
self.assertIn((
244+
'<script src="/static/django_webpack_loader_bundles/main.js" >'
245+
'</script>'), result.rendered_content
246+
)
247+
self.assertIn((
248+
'<link href="/static/django_webpack_loader_bundles/main.css" rel="stylesheet" />'),
249+
result.rendered_content
250+
)
251+
252+
# return removed key
253+
loader.config['INTEGRITY'] = integrity_from_config
254+
232255
def test_integrity_missing_hash(self):
233256
self.compile_bundles('webpack.config.simple.js')
234257

0 commit comments

Comments
 (0)