|
1 | 1 | from __future__ import unicode_literals
|
2 | 2 |
|
| 3 | +from django.conf import settings |
| 4 | +from django.contrib.staticfiles import finders |
3 | 5 | from django.contrib.staticfiles.storage import staticfiles_storage
|
4 | 6 | from django.core.management import call_command
|
5 | 7 | from django.test import TestCase
|
@@ -69,3 +71,27 @@ def test_post_process_no_path(self):
|
69 | 71 | call_command('collectstatic', verbosity=0, interactive=False)
|
70 | 72 | except NotImplementedError:
|
71 | 73 | self.fail('Received an error running collectstatic')
|
| 74 | + |
| 75 | + def test_nonexistent_file_pipeline_finder(self): |
| 76 | + CUSTOM_FINDERS = settings.STATICFILES_FINDERS + ('pipeline.finders.PipelineFinder',) |
| 77 | + with self.settings(STATICFILES_FINDERS=CUSTOM_FINDERS): |
| 78 | + path = finders.find('nothing.css') |
| 79 | + self.assertIsNone(path) |
| 80 | + |
| 81 | + def test_nonexistent_file_cached_finder(self): |
| 82 | + CUSTOM_FINDERS = settings.STATICFILES_FINDERS + ('pipeline.finders.CachedFileFinder',) |
| 83 | + with self.settings(STATICFILES_FINDERS=CUSTOM_FINDERS): |
| 84 | + path = finders.find('nothing.css') |
| 85 | + self.assertIsNone(path) |
| 86 | + |
| 87 | + def test_nonexistent_double_extension_file_pipeline_finder(self): |
| 88 | + CUSTOM_FINDERS = settings.STATICFILES_FINDERS + ('pipeline.finders.PipelineFinder',) |
| 89 | + with self.settings(STATICFILES_FINDERS=CUSTOM_FINDERS): |
| 90 | + path = finders.find('app.css.map') |
| 91 | + self.assertIsNone(path) |
| 92 | + |
| 93 | + def test_nonexistent_double_extension_file_cached_finder(self): |
| 94 | + CUSTOM_FINDERS = settings.STATICFILES_FINDERS + ('pipeline.finders.CachedFileFinder',) |
| 95 | + with self.settings(STATICFILES_FINDERS=CUSTOM_FINDERS): |
| 96 | + path = finders.find('app.css.map') |
| 97 | + self.assertIsNone(path) |
0 commit comments