Commit bdf21bd5 by Timothée Peignier

fix regression in storage. close #288

parent 61783d94
......@@ -103,8 +103,8 @@ class BaseFinderStorage(PipelineStorage):
for finder in self.finders.get_finders():
path = finder.find(name)
if path:
for storage_root, storage in finder.storages.items():
if path.startswith(storage_root):
for storage in finder.storages.values():
if path.startswith(storage.location):
return path, storage
raise ValueError("The file '%s' could not be found with %r." % (name, self))
......
......@@ -50,7 +50,7 @@ PIPELINE_CSS = {
'source_filenames': (
'pipeline/css/first.css',
'pipeline/css/second.css',
'pipeline/css/urls.css',
'pipeline/css/urls.css'
),
'output_filename': 'screen.css'
}
......
......@@ -3,25 +3,30 @@ from __future__ import unicode_literals
from django.test import TestCase
from django.utils.datastructures import SortedDict
from pipeline.storage import PipelineStorage
from pipeline.storage import PipelineStorage, PipelineFinderStorage
from tests.utils import pipeline_settings
class StorageTest(TestCase):
def setUp(self):
self.storage = PipelineStorage()
def test_post_process_dry_run(self):
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, [])
def test_post_process(self):
storage = PipelineStorage()
with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None):
processed_files = self.storage.post_process(SortedDict({
'css/first.css': (self.storage, 'css/first.css'),
'images/arrow.png': (self.storage, 'images/arrow.png')
processed_files = storage.post_process(SortedDict({
'css/first.css': (storage, 'css/first.css'),
'images/arrow.png': (storage, 'images/arrow.png')
}))
self.assertTrue(('css/first.css', 'css/first.css', 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