Commit bdf21bd5 by Timothée Peignier

fix regression in storage. close #288

parent 61783d94
...@@ -103,8 +103,8 @@ class BaseFinderStorage(PipelineStorage): ...@@ -103,8 +103,8 @@ class BaseFinderStorage(PipelineStorage):
for finder in self.finders.get_finders(): for finder in self.finders.get_finders():
path = finder.find(name) path = finder.find(name)
if path: if path:
for storage_root, storage in finder.storages.items(): for storage in finder.storages.values():
if path.startswith(storage_root): if path.startswith(storage.location):
return path, storage return path, storage
raise ValueError("The file '%s' could not be found with %r." % (name, self)) raise ValueError("The file '%s' could not be found with %r." % (name, self))
......
...@@ -50,7 +50,7 @@ PIPELINE_CSS = { ...@@ -50,7 +50,7 @@ PIPELINE_CSS = {
'source_filenames': ( 'source_filenames': (
'pipeline/css/first.css', 'pipeline/css/first.css',
'pipeline/css/second.css', 'pipeline/css/second.css',
'pipeline/css/urls.css', 'pipeline/css/urls.css'
), ),
'output_filename': 'screen.css' 'output_filename': 'screen.css'
} }
......
...@@ -3,25 +3,30 @@ from __future__ import unicode_literals ...@@ -3,25 +3,30 @@ from __future__ import unicode_literals
from django.test import TestCase from django.test import TestCase
from django.utils.datastructures import SortedDict from django.utils.datastructures import SortedDict
from pipeline.storage import PipelineStorage from pipeline.storage import PipelineStorage, PipelineFinderStorage
from tests.utils import pipeline_settings from tests.utils import pipeline_settings
class StorageTest(TestCase): class StorageTest(TestCase):
def setUp(self):
self.storage = PipelineStorage()
def test_post_process_dry_run(self): def test_post_process_dry_run(self):
with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None): with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None):
processed_files = self.storage.post_process([], True) processed_files = PipelineStorage().post_process([], True)
self.assertEqual(processed_files, []) self.assertEqual(processed_files, [])
def test_post_process(self): def test_post_process(self):
storage = PipelineStorage()
with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None): with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None):
processed_files = self.storage.post_process(SortedDict({ processed_files = storage.post_process(SortedDict({
'css/first.css': (self.storage, 'css/first.css'), 'css/first.css': (storage, 'css/first.css'),
'images/arrow.png': (self.storage, 'images/arrow.png') 'images/arrow.png': (storage, 'images/arrow.png')
})) }))
self.assertTrue(('css/first.css', 'css/first.css', True) in processed_files) self.assertTrue(('css/first.css', 'css/first.css', True) in processed_files)
self.assertTrue(('images/arrow.png', 'images/arrow.png', True) in processed_files) self.assertTrue(('images/arrow.png', 'images/arrow.png', True) in processed_files)
def test_find_storage(self):
try:
storage = PipelineFinderStorage()
storage.find_storage('testing.css')
except ValueError:
self.fail()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment