Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a test wrt cache invalidation.

  • Loading branch information...
commit 9dc756919617624fe599af4ead7cb75184b904ba 1 parent 25b8225
@jezdez authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 staticfiles/tests/tests.py
View
15 staticfiles/tests/tests.py
@@ -444,6 +444,21 @@ def test_template_tag_url(self):
with storage.staticfiles_storage.open(relpath) as relfile:
self.assertIn("https://", relfile.read())
+ def test_cache_invalidation(self):
+ name = "cached/styles.css"
+ hashed_name = "cached/styles.93b1147e8552.css"
+ # check if the cache is filled correctly as expected
+ cache_key = storage.staticfiles_storage.cache_key(name)
+ cached_name = storage.staticfiles_storage.cache.get(cache_key)
+ self.assertEqual(self.cached_file_path(name), cached_name)
+ # clearing the cache to make sure we re-set it correctly in the url method
+ storage.staticfiles_storage.cache.clear()
+ cached_name = storage.staticfiles_storage.cache.get(cache_key)
+ self.assertEqual(cached_name, None)
+ self.assertEqual(self.cached_file_path(name), hashed_name)
+ cached_name = storage.staticfiles_storage.cache.get(cache_key)
+ self.assertEqual(cached_name, hashed_name)
+
def test_post_processing(self):
"""Test that post_processing behaves correctly.
Please sign in to comment.
Something went wrong with that request. Please try again.