summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-09-21 15:58:21 +0000
committerJannis Leidel <jannis@leidel.info>2011-09-21 15:58:21 +0000
commiteb5df8e98db5c5592d5f0a0ca4680f9368ed0db5 (patch)
tree6851a5f6f0694232af02e1421dbf39c8f1338e72 /tests
parent75199e8f6d96887c10ba79870428e04ed34e1ca5 (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/staticfiles_tests/project/documents/cached/css/img/window.pngbin0 -> 207 bytes
-rw-r--r--tests/regressiontests/staticfiles_tests/project/documents/cached/css/window.css3
-rw-r--r--tests/regressiontests/staticfiles_tests/project/documents/cached/img/relative.pngbin0 -> 207 bytes
-rw-r--r--tests/regressiontests/staticfiles_tests/project/documents/cached/relative.css5
-rw-r--r--tests/regressiontests/staticfiles_tests/project/documents/cached/styles.css2
-rw-r--r--tests/regressiontests/staticfiles_tests/tests.py22
6 files changed, 24 insertions, 8 deletions
diff --git a/tests/regressiontests/staticfiles_tests/project/documents/cached/css/img/window.png b/tests/regressiontests/staticfiles_tests/project/documents/cached/css/img/window.png
new file mode 100644
index 0000000000..ba48325c0a
--- /dev/null
+++ b/tests/regressiontests/staticfiles_tests/project/documents/cached/css/img/window.png
Binary files differ
diff --git a/tests/regressiontests/staticfiles_tests/project/documents/cached/css/window.css b/tests/regressiontests/staticfiles_tests/project/documents/cached/css/window.css
new file mode 100644
index 0000000000..9fea4e8a5e
--- /dev/null
+++ b/tests/regressiontests/staticfiles_tests/project/documents/cached/css/window.css
@@ -0,0 +1,3 @@
+body {
+ background: #d3d6d8 url("img/window.png");
+} \ No newline at end of file
diff --git a/tests/regressiontests/staticfiles_tests/project/documents/cached/img/relative.png b/tests/regressiontests/staticfiles_tests/project/documents/cached/img/relative.png
new file mode 100644
index 0000000000..ba48325c0a
--- /dev/null
+++ b/tests/regressiontests/staticfiles_tests/project/documents/cached/img/relative.png
Binary files differ
diff --git a/tests/regressiontests/staticfiles_tests/project/documents/cached/relative.css b/tests/regressiontests/staticfiles_tests/project/documents/cached/relative.css
index 40c4a256aa..afa658dbeb 100644
--- a/tests/regressiontests/staticfiles_tests/project/documents/cached/relative.css
+++ b/tests/regressiontests/staticfiles_tests/project/documents/cached/relative.css
@@ -1,2 +1,5 @@
@import url("../cached/styles.css");
-@import url("absolute.css"); \ No newline at end of file
+@import url("absolute.css");
+body {
+ background: #d3d6d8 url(img/relative.png);
+} \ No newline at end of file
diff --git a/tests/regressiontests/staticfiles_tests/project/documents/cached/styles.css b/tests/regressiontests/staticfiles_tests/project/documents/cached/styles.css
index 84936d1dcb..ca28fc35cd 100644
--- a/tests/regressiontests/staticfiles_tests/project/documents/cached/styles.css
+++ b/tests/regressiontests/staticfiles_tests/project/documents/cached/styles.css
@@ -1 +1 @@
-@import url("cached/other.css"); \ No newline at end of file
+@import url("other.css"); \ No newline at end of file
diff --git a/tests/regressiontests/staticfiles_tests/tests.py b/tests/regressiontests/staticfiles_tests/tests.py
index 40569484df..8a179141b9 100644
--- a/tests/regressiontests/staticfiles_tests/tests.py
+++ b/tests/regressiontests/staticfiles_tests/tests.py
@@ -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")