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
238b4a5d
Commit
238b4a5d
authored
Jun 24, 2014
by
James Tauber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests for PR 3769
Two out of three fail without PR 3769 but all pass with PR 3769.
parent
99cfea15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
lms/djangoapps/courseware/tests/test_favicon.py
+57
-0
No files found.
lms/djangoapps/courseware/tests/test_favicon.py
0 → 100644
View file @
238b4a5d
from
django.conf
import
settings
from
django.core.urlresolvers
import
clear_url_caches
,
resolve
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
mock
import
patch
import
sys
class
FaviconTestCase
(
TestCase
):
def
setUp
(
self
):
super
(
FaviconTestCase
,
self
)
.
setUp
()
def
test_favicon_redirect
(
self
):
resp
=
self
.
client
.
get
(
"/favicon.ico"
)
self
.
assertEqual
(
resp
.
status_code
,
301
)
self
.
assertRedirects
(
resp
,
"/static/images/favicon.ico"
,
status_code
=
301
,
target_status_code
=
404
# @@@ how to avoid 404?
)
@override_settings
(
FAVICON_PATH
=
"images/foo.ico"
)
def
test_favicon_redirect_with_favicon_path_setting
(
self
):
# for some reason I had to put this inline rather than just using
# the UrlResetMixin
urlconf
=
settings
.
ROOT_URLCONF
if
urlconf
in
sys
.
modules
:
reload
(
sys
.
modules
[
urlconf
])
clear_url_caches
()
resolve
(
"/"
)
resp
=
self
.
client
.
get
(
"/favicon.ico"
)
self
.
assertEqual
(
resp
.
status_code
,
301
)
self
.
assertRedirects
(
resp
,
"/static/images/foo.ico"
,
status_code
=
301
,
target_status_code
=
404
# @@@ how to avoid 404?
)
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"USE_CUSTOM_THEME"
:
True
})
@override_settings
(
THEME_NAME
=
"bar"
)
def
test_favicon_redirect_with_theme
(
self
):
self
.
assertEqual
(
settings
.
FEATURES
[
"USE_CUSTOM_THEME"
],
True
)
resp
=
self
.
client
.
get
(
"/favicon.ico"
)
self
.
assertEqual
(
resp
.
status_code
,
301
)
self
.
assertRedirects
(
resp
,
"/static/images/foo.ico"
,
status_code
=
301
,
target_status_code
=
404
# @@@ how to avoid 404?
)
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