summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests/test_storage.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/staticfiles_tests/test_storage.py')
-rw-r--r--tests/staticfiles_tests/test_storage.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py
index 7ae88e6c68..c6e2c48d93 100644
--- a/tests/staticfiles_tests/test_storage.py
+++ b/tests/staticfiles_tests/test_storage.py
@@ -216,6 +216,30 @@ class TestHashedFiles:
self.assertIn(b"other.d41d8cd98f00.css", content)
self.assertPostCondition()
+ def test_js_source_map(self):
+ relpath = self.hashed_file_path('cached/source_map.js')
+ self.assertEqual(relpath, 'cached/source_map.9371cbb02a26.js')
+ with storage.staticfiles_storage.open(relpath) as relfile:
+ content = relfile.read()
+ self.assertNotIn(b'//# sourceMappingURL=source_map.js.map', content)
+ self.assertIn(
+ b'//# sourceMappingURL=source_map.js.99914b932bd3.map',
+ content,
+ )
+ self.assertPostCondition()
+
+ def test_js_source_map_sensitive(self):
+ relpath = self.hashed_file_path('cached/source_map_sensitive.js')
+ self.assertEqual(relpath, 'cached/source_map_sensitive.5da96fdd3cb3.js')
+ with storage.staticfiles_storage.open(relpath) as relfile:
+ content = relfile.read()
+ self.assertIn(b'//# sOuRcEMaPpInGURL=source_map.js.map', content)
+ self.assertNotIn(
+ b'//# sourceMappingURL=source_map.js.99914b932bd3.map',
+ content,
+ )
+ self.assertPostCondition()
+
@override_settings(
STATICFILES_DIRS=[os.path.join(TEST_ROOT, 'project', 'faulty')],
STATICFILES_FINDERS=['django.contrib.staticfiles.finders.FileSystemFinder'],