Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
c124fb34
Commit
c124fb34
authored
8 years ago
by
Calen Pennington
Browse files
Options
Downloads
Patches
Plain Diff
Make test_favicon tests work independently
parent
e93d112c
No related branches found
Branches containing commit
Tags
release-2021-03-09-09.49
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lms/djangoapps/courseware/tests/test_favicon.py
+10
-14
10 additions, 14 deletions
lms/djangoapps/courseware/tests/test_favicon.py
with
10 additions
and
14 deletions
lms/djangoapps/courseware/tests/test_favicon.py
+
10
−
14
View file @
c124fb34
...
...
@@ -9,12 +9,14 @@ from nose.plugins.attrib import attr
import
sys
from
util.testing
import
UrlResetMixin
@attr
(
'
shard_1
'
)
class
FaviconTestCase
(
TestCase
):
def
setUp
(
self
):
super
(
FaviconTestCase
,
self
).
setUp
()
@attr
(
'
shard_1
'
)
class
FaviconTestCase
(
UrlResetMixin
,
TestCase
):
"""
Tests of the courseware favicon.
"""
def
test_favicon_redirect
(
self
):
resp
=
self
.
client
.
get
(
"
/favicon.ico
"
)
...
...
@@ -27,15 +29,7 @@ class FaviconTestCase(TestCase):
@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
(
"
/
"
)
self
.
reset_urls
()
resp
=
self
.
client
.
get
(
"
/favicon.ico
"
)
self
.
assertEqual
(
resp
.
status_code
,
301
)
...
...
@@ -46,14 +40,16 @@ class FaviconTestCase(TestCase):
)
@patch.dict
(
"
django.conf.settings.FEATURES
"
,
{
"
USE_CUSTOM_THEME
"
:
True
})
@override_settings
(
FAVICON_PATH
=
"
images/bar_fav.ico
"
)
@override_settings
(
THEME_NAME
=
"
bar
"
)
def
test_favicon_redirect_with_theme
(
self
):
self
.
assertEqual
(
settings
.
FEATURES
[
"
USE_CUSTOM_THEME
"
],
True
)
self
.
reset_urls
()
resp
=
self
.
client
.
get
(
"
/favicon.ico
"
)
self
.
assertEqual
(
resp
.
status_code
,
301
)
self
.
assertRedirects
(
resp
,
"
/static/images/
foo
.ico
"
,
"
/static/images/
bar_fav
.ico
"
,
status_code
=
301
,
target_status_code
=
404
# @@@ how to avoid 404?
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment