Commit 1d5f564a by Timothée Peignier

improving and adding new tests

parent 170a73b0
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
.concat{display:none}.concatenate{display:block}@font-face{font-family:'Pipeline';src:url(/static/fonts/pipeline.eot);src:url(/static/fonts/pipeline.eot?#iefix) format('embedded-opentype');src:local('☺'),url(/static/fonts/pipeline.woff) format('woff'),url(/static/fonts/pipeline.ttf) format('truetype'),url(/static/fonts/pipeline.svg#IyfZbseF) format('svg');font-weight:normal;font-style:normal}.relative-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-url{background-image:url(/static/images/sprite-buttons.png)}.absolute-full-url{background-image:url(http://localhost/images/sprite-buttons.png)}.no-protocol-url{background-image:url(//images/sprite-buttons.png)}
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
(function(){function b(){console.log(arguments)}function a(){console.log("hello world")}function(){alert("this is a test")}window.JST=window.JST||{};window.JST.photo_detail=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> by <%= author %> </div></div>');window.JST.photo_list=_.template('<div class="photo"> <img src="<%= src %>" /> <div class="caption"> <%= caption %> </div></div>');window.JST.video_detail=_.template('<div class="video"> <video src="<%= src %>" /> <div class="caption"> <%= description %> </div></div>')}).call(this);
\ No newline at end of file
.concat{display:none}
\ No newline at end of file
import os
local_path = lambda path: os.path.join(os.path.dirname(__file__), path)
DATABASES = {
......@@ -14,6 +13,7 @@ SITE_ID = 1
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.auth',
'django.contrib.admin',
'pipeline',
......@@ -24,10 +24,43 @@ MEDIA_URL = '/media/'
MEDIA_ROOT = local_path('media')
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
STATIC_ROOT = local_path('static/')
STATIC_URL = '/static/'
STATICFILES_DIRS = (
local_path('assets/'),
)
STATICFILES_FINDERS = (
'pipeline.finders.PipelineFinder',
'django.contrib.staticfiles.finders.FileSystemFinder'
)
STATIC_ROOT = local_path('assets')
PIPELINE_ROOT = local_path('assets/')
PIPELINE_URL = STATIC_URL
PIPELINE_TEMPLATE_EXT = ".jst"
TEMPLATE_DIRS = (
local_path('templates'),
)
PIPELINE_CSS = {
'screen': {
'source_filenames': (
'css/first.css',
'css/second.css',
'css/urls.css',
),
'output_filename': 'screen.css'
}
}
PIPELINE_JS = {
'scripts': {
'source_filenames': (
'js/first.js',
'js/second.js',
'js/application.js',
'templates/**/*.jst'
),
'output_filename': 'scripts.css'
}
}
from packager import *
from versioning import *
from compressor import *
from compiler import *
from storage import *
from django.test import TestCase
from pipeline.conf import settings
from pipeline.storage import PipelineStorage
class StorageTest(TestCase):
def setUp(self):
settings.PIPELINE_CSS = {
'testing': {
'source_filenames': (
'css/first.css',
),
'manifest': False,
'output_filename': 'testing.r?.css',
}
}
self.storage = PipelineStorage()
def test_post_process_dry_run(self):
processed_files = self.storage.post_process([], True)
self.assertEqual(processed_files, [])
def test_post_process(self):
processed_files = self.storage.post_process([
'css/first.css',
'images/arrow.png'
])
self.assertEqual(processed_files, [
'css/first.css',
'images/arrow.png'
])
def tearDown(self):
settings.PIPELINE_CSS = {}
from mock import patch
from django.test import TestCase
from pipeline.conf import settings
from pipeline.storage import storage
from pipeline.versioning import Versioning
from pipeline.versioning.mtime import MTimeVersioning
class VersioningTest(TestCase):
def setUp(self):
self.versioning = Versioning()
self.old_pipeline_version = settings.PIPELINE_VERSION
def test_versioner_class(self):
self.assertTrue(isinstance(self.versioning.versioner, MTimeVersioning))
def test_output_filename(self):
output_filename = self.versioning.output_filename("css/master.?.css",
"1308127956")
self.assertEquals(output_filename, 'css/master.0.css')
def test_output_filename_with_version(self):
settings.PIPELINE_VERSION = True
output_filename = self.versioning.output_filename("css/master.?.css",
"1308127956")
self.assertEquals(output_filename, 'css/master.1308127956.css')
@patch.object(MTimeVersioning, 'version')
def test_need_update(self, mock):
mock.return_value = "1307480052"
need_update, version = self.versioning.need_update('css/master.1308127956.css',
['css/first.css'],
)
self.assertEquals(need_update, True)
self.assertEquals(version, "1307480052")
@patch.object(MTimeVersioning, 'need_update')
def test_no_update(self, mock):
mock.return_value = (False, "123456")
need_update, version = self.versioning.need_update('css/master.123456.css',
['css/first.css'],
)
self.assertTrue(mock.called)
self.assertEquals(need_update, False)
self.assertEquals(version, "123456")
@patch.object(MTimeVersioning, 'version')
def test_version(self, mock):
mock.return_value = "123456"
version = self.versioning.version(['css/first.css'])
self.assertTrue(mock.called)
self.assertEquals(version, "123456")
def test_version_from_file(self):
settings.PIPELINE_VERSION = True
version = self.versioning.version_from_file('css/',
"master.?.css")
self.assertEquals(version, "123456")
@patch.object(storage, 'exists')
def test_no_cleanup(self, mock):
self.versioning.cleanup('css/master.?.css')
self.assertFalse(mock.called)
@patch.object(storage, 'delete')
def test_cleanup(self, mock):
settings.PIPELINE_VERSION = True
self.versioning.cleanup('css/master.?.css')
mock.assert_called_with('css/master.123456.css')
def tearDown(self):
settings.PIPELINE_VERSION = self.old_pipeline_version
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