summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests
diff options
context:
space:
mode:
authorzeyneloz <ozdemir.zynl@gmail.com>2019-08-01 16:42:58 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-08-02 08:35:28 +0200
commit955b382600e4626265cc20e5773bdbcfd01fc4af (patch)
treed6a8a32202fa5c5c245cdc6f5667eaed6c43aa2e /tests/staticfiles_tests
parent246689452d33ff0dbf8e28b6948b23261083b187 (diff)
downloaddjango-955b382600e4626265cc20e5773bdbcfd01fc4af.tar.gz
Fixed #30599 -- Prevented ManifestFilesMixin.read_manifest() from silencing errors other than FileNotFoundError.
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r--tests/staticfiles_tests/test_storage.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py
index 59ed734704..93bd60446a 100644
--- a/tests/staticfiles_tests/test_storage.py
+++ b/tests/staticfiles_tests/test_storage.py
@@ -4,6 +4,7 @@ import sys
import tempfile
import unittest
from io import StringIO
+from unittest import mock
from django.conf import settings
from django.contrib.staticfiles import finders, storage
@@ -389,6 +390,11 @@ class TestCollectionManifestStorage(TestHashedFiles, CollectionTestCase):
storage.staticfiles_storage.manifest_name = 'does.not.exist.json'
self.assertIsNone(storage.staticfiles_storage.read_manifest())
+ def test_manifest_does_not_ignore_permission_error(self):
+ with mock.patch('builtins.open', side_effect=PermissionError):
+ with self.assertRaises(PermissionError):
+ storage.staticfiles_storage.read_manifest()
+
def test_loaded_cache(self):
self.assertNotEqual(storage.staticfiles_storage.hashed_files, {})
manifest_content = storage.staticfiles_storage.read_manifest()