mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed the relative static file resolution of the CachedStaticFilesStorage backend and the post processing of deeply nested static files.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16862 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
75199e8f6d
commit
eb5df8e98d
7 changed files with 40 additions and 15 deletions
|
@ -300,11 +300,11 @@ class TestCollectionCachedStorage(BaseCollectionTestCase,
|
|||
""", "/static/test/file.dad0999e4f8f.txt")
|
||||
self.assertTemplateRenders("""
|
||||
{% load static from staticfiles %}{% static "cached/styles.css" %}
|
||||
""", "/static/cached/styles.5653c259030b.css")
|
||||
""", "/static/cached/styles.93b1147e8552.css")
|
||||
|
||||
def test_template_tag_simple_content(self):
|
||||
relpath = self.cached_file_path("cached/styles.css")
|
||||
self.assertEqual(relpath, "cached/styles.5653c259030b.css")
|
||||
self.assertEqual(relpath, "cached/styles.93b1147e8552.css")
|
||||
with storage.staticfiles_storage.open(relpath) as relfile:
|
||||
content = relfile.read()
|
||||
self.assertFalse("cached/other.css" in content, content)
|
||||
|
@ -316,7 +316,7 @@ class TestCollectionCachedStorage(BaseCollectionTestCase,
|
|||
with storage.staticfiles_storage.open(relpath) as relfile:
|
||||
content = relfile.read()
|
||||
self.assertFalse("/static/cached/styles.css" in content)
|
||||
self.assertTrue("/static/cached/styles.5653c259030b.css" in content)
|
||||
self.assertTrue("/static/cached/styles.93b1147e8552.css" in content)
|
||||
|
||||
def test_template_tag_denorm(self):
|
||||
relpath = self.cached_file_path("cached/denorm.css")
|
||||
|
@ -324,16 +324,26 @@ class TestCollectionCachedStorage(BaseCollectionTestCase,
|
|||
with storage.staticfiles_storage.open(relpath) as relfile:
|
||||
content = relfile.read()
|
||||
self.assertFalse("..//cached///styles.css" in content)
|
||||
self.assertTrue("/static/cached/styles.5653c259030b.css" in content)
|
||||
self.assertTrue("/static/cached/styles.93b1147e8552.css" in content)
|
||||
|
||||
def test_template_tag_relative(self):
|
||||
relpath = self.cached_file_path("cached/relative.css")
|
||||
self.assertEqual(relpath, "cached/relative.298ff891a8d4.css")
|
||||
self.assertEqual(relpath, "cached/relative.8dffb45d91f5.css")
|
||||
with storage.staticfiles_storage.open(relpath) as relfile:
|
||||
content = relfile.read()
|
||||
self.assertFalse("../cached/styles.css" in content)
|
||||
self.assertFalse('@import "styles.css"' in content)
|
||||
self.assertTrue("/static/cached/styles.5653c259030b.css" in content)
|
||||
self.assertTrue("/static/cached/styles.93b1147e8552.css" in content)
|
||||
self.assertFalse("url(img/relative.png)" in content)
|
||||
self.assertTrue("/static/cached/img/relative.acae32e4532b.png" in content)
|
||||
|
||||
def test_template_tag_deep_relative(self):
|
||||
relpath = self.cached_file_path("cached/css/window.css")
|
||||
self.assertEqual(relpath, "cached/css/window.9db38d5169f3.css")
|
||||
with storage.staticfiles_storage.open(relpath) as relfile:
|
||||
content = relfile.read()
|
||||
self.assertFalse('url(img/window.png)' in content)
|
||||
self.assertTrue('url("/static/cached/css/img/window.acae32e4532b.png")' in content)
|
||||
|
||||
def test_template_tag_url(self):
|
||||
relpath = self.cached_file_path("cached/url.css")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue