Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
b7ac2edc
Commit
b7ac2edc
authored
Jan 12, 2013
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved tests
parent
2ef7581d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
pipeline/jinja2/ext.py
+2
-3
tests/tests/__init__.py
+3
-1
tests/tests/test_extension.py
+18
-0
No files found.
pipeline/jinja2/ext.py
View file @
b7ac2edc
...
...
@@ -24,9 +24,7 @@ class PipelineExtension(Extension):
package_name
=
parser
.
parse_expression
()
.
value
if
tag
.
value
==
"compressed_css"
:
return
nodes
.
Output
([
self
.
call_method
(
'package_css'
,
args
=
[
package_name
]),
])
.
set_lineno
(
tag
.
lineno
)
return
self
.
package_css
(
package_name
)
if
tag
.
value
==
"compressed_js"
:
return
nodes
.
Output
([
...
...
@@ -44,6 +42,7 @@ class PipelineExtension(Extension):
try
:
package
=
packager
.
package_for
(
'css'
,
package_name
)
except
PackageNotFound
:
return
self
.
environment
.
get_template
(
'pipeline/css.jinja'
)
.
module
return
nodes
.
Markup
(
''
)
if
settings
.
PIPELINE
:
...
...
tests/tests/__init__.py
View file @
b7ac2edc
# -*- coding: utf-8 flake8: noqa -*-
from
.test_compiler
import
*
from
.test_compressor
import
*
from
.test_extension
import
*
from
.test_glob
import
*
from
.test_packager
import
*
from
.test_storage
import
*
from
.test_utils
import
*
from
.test_utils
import
*
\ No newline at end of file
tests/tests/test_extension.py
0 → 100644
View file @
b7ac2edc
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
jinja2
import
Environment
,
PackageLoader
from
django.test
import
TestCase
from
pipeline.jinja2.ext
import
PipelineExtension
class
ExtensionTest
(
TestCase
):
def
setUp
(
self
):
self
.
env
=
Environment
(
extensions
=
[
PipelineExtension
],
loader
=
PackageLoader
(
'pipeline'
,
'templates'
))
def
test_no_package
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_css 'unknow'
%
}"""
)
self
.
assertEqual
(
u''
,
template
.
render
(
context
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment