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
c8ed240d
Commit
c8ed240d
authored
Apr 30, 2011
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test css url rewrite
parent
5072bbeb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
compress/compilers/__init__.py
+1
-1
tests/static/css/urls.css
+10
-0
tests/tests.py
+22
-1
No files found.
compress/compilers/__init__.py
View file @
c8ed240d
...
...
@@ -23,7 +23,7 @@ class Compiler(object):
try
:
compiled_content
=
compiler
.
compile_file
(
content
)
self
.
save_file
(
new_path
,
compiled_content
)
except
CompilerError
,
e
:
except
CompilerError
:
if
not
os
.
path
.
exists
(
new_path
):
raise
paths
[
index
]
=
new_path
...
...
tests/static/css/urls.css
0 → 100644
View file @
c8ed240d
.relative-url
{
background-image
:
url(../images/sprite-buttons.png)
;
}
.absolute-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
tests/tests.py
View file @
c8ed240d
...
...
@@ -3,6 +3,7 @@ import os
from
django.test
import
TestCase
from
compress.conf
import
settings
from
compress.compressors
import
Compressor
from
compress.packager
import
Packager
...
...
@@ -28,7 +29,27 @@ class VersioningTest(TestCase):
class
CompressorTest
(
TestCase
):
pass
def
setUp
(
self
):
self
.
old_compress_url
=
settings
.
COMPRESS_URL
settings
.
COMPRESS_URL
=
'http://localhost/static/'
def
test_url_rewrite
(
self
):
compressor
=
Compressor
()
output
=
compressor
.
concatenate_and_rewrite
([
os
.
path
.
join
(
settings
.
COMPRESS_ROOT
,
'css/urls.css'
),
])
self
.
assertEquals
(
""".relative-url {
background-image: url(http://localhost/static/images/sprite-buttons.png);
}
.absolute-url {
background-image: url(http://localhost/images/sprite-buttons.png);
}
.no-protocol-url {
background-image: url(//images/sprite-buttons.png);
}"""
,
output
)
def
tearDown
(
self
):
settings
.
COMPRESS_URL
=
self
.
old_compress_url
class
CompilerTest
(
TestCase
):
...
...
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