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
e0ff4d47
Commit
e0ff4d47
authored
Nov 28, 2013
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests
parent
bb5d2b68
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
27 deletions
+23
-27
tests/tests/__init__.py
+1
-1
tests/tests/test_storage.py
+11
-25
tests/tests/test_template.py
+11
-1
No files found.
tests/tests/__init__.py
View file @
e0ff4d47
# -*- coding: utf-8 flake8: noqa -*-
from
.test_compiler
import
*
from
.test_compressor
import
*
from
.test_
extension
import
*
from
.test_
template
import
*
from
.test_glob
import
*
from
.test_middleware
import
*
from
.test_packager
import
*
...
...
tests/tests/test_storage.py
View file @
e0ff4d47
...
...
@@ -3,39 +3,25 @@ from __future__ import unicode_literals
from
django.test
import
TestCase
from
django.utils.datastructures
import
SortedDict
from
pipeline.conf
import
settings
from
pipeline.storage
import
PipelineStorage
from
tests.utils
import
_
from
tests.utils
import
pipeline_settings
class
StorageTest
(
TestCase
):
def
setUp
(
self
):
settings
.
PIPELINE_CSS
=
{
'testing'
:
{
'source_filenames'
:
(
_
(
'pipeline/css/first.css'
),
_
(
'css/third.css'
),
),
'manifest'
:
False
,
'output_filename'
:
'testing.css'
,
}
}
settings
.
PIPELINE_JS_COMPRESSOR
=
None
settings
.
PIPELINE_CSS_COMPRESSOR
=
None
self
.
storage
=
PipelineStorage
()
def
test_post_process_dry_run
(
self
):
processed_files
=
self
.
storage
.
post_process
([],
True
)
self
.
assertEqual
(
processed_files
,
[])
with
pipeline_settings
(
PIPELINE_JS_COMPRESSOR
=
None
,
PIPELINE_CSS_COMPRESSOR
=
None
):
processed_files
=
self
.
storage
.
post_process
([],
True
)
self
.
assertEqual
(
processed_files
,
[])
def
test_post_process
(
self
):
processed_files
=
self
.
storage
.
post_process
(
SortedDict
({
'css/first.css'
:
(
self
.
storage
,
'css/first.css'
),
'images/arrow.png'
:
(
self
.
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
tearDown
(
self
):
settings
.
PIPELINE_CSS
=
{}
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'
)
}))
self
.
assertTrue
((
'css/first.css'
,
'css/first.css'
,
True
)
in
processed_files
)
self
.
assertTrue
((
'images/arrow.png'
,
'images/arrow.png'
,
True
)
in
processed_files
)
tests/tests/test_
extension
.py
→
tests/tests/test_
template
.py
View file @
e0ff4d47
...
...
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
from
jinja2
import
Environment
,
PackageLoader
from
django.template
import
Template
,
Context
from
django.test
import
TestCase
from
pipeline.jinja2.ext
import
PipelineExtension
...
...
@@ -10,7 +11,7 @@ from pipeline.jinja2.ext import PipelineExtension
from
tests.utils
import
pipeline_settings
class
Extension
Test
(
TestCase
):
class
Jinja
Test
(
TestCase
):
def
setUp
(
self
):
self
.
env
=
Environment
(
extensions
=
[
PipelineExtension
],
loader
=
PackageLoader
(
'pipeline'
,
'templates'
))
...
...
@@ -35,3 +36,12 @@ class ExtensionTest(TestCase):
def
test_package_js
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts"
%
}"""
)
self
.
assertEqual
(
u'<script type="text/css" src="/static/scripts.css" charset="utf-8"></script>'
,
template
.
render
())
class
DjangoTest
(
TestCase
):
def
render_template
(
self
,
template
):
return
Template
(
template
)
.
render
(
Context
())
def
test_compressed_css
(
self
):
rendered
=
self
.
render_template
(
u"""{
%
load compressed
%
}{
%
compressed_css "unknow"
%
}"""
)
self
.
assertEqual
(
u""
,
rendered
)
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