Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
2302b400
Commit
2302b400
authored
Feb 06, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix static_replace tests
parent
96eb16cd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
common/djangoapps/static_replace/test/test_static_replace.py
+20
-8
No files found.
common/djangoapps/static_replace/test/test_static_replace.py
View file @
2302b400
...
@@ -24,15 +24,24 @@ def test_multi_replace():
...
@@ -24,15 +24,24 @@ def test_multi_replace():
)
)
@patch
(
'static_replace.finders'
)
@patch
(
'static_replace.staticfiles_storage'
)
@patch
(
'static_replace.settings'
)
def
test_storage_url_exists
(
mock_storage
):
def
test_debug_no_modify
(
mock_settings
,
mock_finders
):
mock_storage
.
exists
.
return_value
=
True
mock_settings
.
DEBUG
=
True
mock_storage
.
url
.
return_value
=
'/static/file.png'
mock_finders
.
find
.
return_value
=
True
assert_equals
(
'"/static/file.png"'
,
replace_static_urls
(
STATIC_SOURCE
,
DATA_DIRECTORY
))
mock_storage
.
exists
.
called_once_with
(
'file.png'
)
mock_storage
.
url
.
called_once_with
(
'data_dir/file.png'
)
assert_equals
(
STATIC_SOURCE
,
replace_static_urls
(
STATIC_SOURCE
,
DATA_DIRECTORY
))
@patch
(
'static_replace.staticfiles_storage'
)
def
test_storage_url_not_exists
(
mock_storage
):
mock_storage
.
exists
.
return_value
=
False
mock_storage
.
url
.
return_value
=
'/static/data_dir/file.png'
mock_finders
.
find
.
assert_called_once_with
(
'file.png'
,
True
)
assert_equals
(
'"/static/data_dir/file.png"'
,
replace_static_urls
(
STATIC_SOURCE
,
DATA_DIRECTORY
))
mock_storage
.
exists
.
called_once_with
(
'file.png'
)
mock_storage
.
url
.
called_once_with
(
'file.png'
)
@patch
(
'static_replace.StaticContent'
)
@patch
(
'static_replace.StaticContent'
)
...
@@ -58,7 +67,10 @@ def test_mongo_filestore(mock_modulestore, mock_static_content):
...
@@ -58,7 +67,10 @@ def test_mongo_filestore(mock_modulestore, mock_static_content):
@patch
(
'static_replace.staticfiles_storage'
)
@patch
(
'static_replace.staticfiles_storage'
)
def
test_data_dir_fallback
(
mock_storage
,
mock_modulestore
,
mock_settings
):
def
test_data_dir_fallback
(
mock_storage
,
mock_modulestore
,
mock_settings
):
mock_modulestore
.
return_value
=
Mock
(
XMLModuleStore
)
mock_modulestore
.
return_value
=
Mock
(
XMLModuleStore
)
mock_settings
.
DEBUG
=
False
mock_storage
.
url
.
side_effect
=
Exception
mock_storage
.
url
.
side_effect
=
Exception
mock_storage
.
exists
.
return_value
=
True
assert_equals
(
'"/static/data_dir/file.png"'
,
replace_static_urls
(
STATIC_SOURCE
,
DATA_DIRECTORY
))
mock_storage
.
exists
.
return_value
=
False
assert_equals
(
'"/static/data_dir/file.png"'
,
replace_static_urls
(
STATIC_SOURCE
,
DATA_DIRECTORY
))
assert_equals
(
'"/static/data_dir/file.png"'
,
replace_static_urls
(
STATIC_SOURCE
,
DATA_DIRECTORY
))
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