Commit 80b8b78c by Timothée Peignier

improving test coverage

parent 81a0f176
...@@ -9,4 +9,5 @@ MANIFEST ...@@ -9,4 +9,5 @@ MANIFEST
docs/_build/ docs/_build/
*.egg-info *.egg-info
.coverage .coverage
htmlcov/ coverage/
\ No newline at end of file tests/static/js/dummy.js
square = (x) -> x * x
cube = (x) -> square(x) * x
from django.test import TestCase from django.test import TestCase
from pipeline.compilers import Compiler from pipeline.conf import settings
from pipeline.compilers import Compiler, CompilerBase
class DummyCompiler(CompilerBase):
output_extension = 'js'
def match_file(self, path):
return path.endswith('.coffee')
def compile_file(self, content):
return content
class CompilerTest(TestCase): class CompilerTest(TestCase):
def setUp(self): def setUp(self):
self.compiler = Compiler() self.compiler = Compiler()
self.old_compilers = settings.PIPELINE_COMPILERS
settings.PIPELINE_COMPILERS = ['tests.tests.compiler.DummyCompiler',]
def test_output_path(self): def test_output_path(self):
output_path = self.compiler.output_path("js/helpers.coffee", "js") output_path = self.compiler.output_path("js/helpers.coffee", "js")
self.assertEquals(output_path, "js/helpers.js") self.assertEquals(output_path, "js/helpers.js")
def test_compilers_class(self):
compilers_class = self.compiler.compilers
self.assertEquals(compilers_class[0], DummyCompiler)
def test_compile(self):
paths = self.compiler.compile([
'js/dummy.coffee',
'js/application.js',
])
self.assertEquals(['js/dummy.js', 'js/application.js'], paths)
def tearDown(self):
settings.PIPELINE_COMPILERS = self.old_compilers
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