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
a169b47c
Commit
a169b47c
authored
Jul 31, 2015
by
Zia Fazal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove certificates menu if html certs not enabled
fixed quality violation
parent
614baab3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
11 deletions
+51
-11
cms/djangoapps/contentstore/views/tests/test_header_menu.py
+47
-0
cms/templates/widgets/header.html
+4
-11
No files found.
cms/djangoapps/contentstore/views/tests/test_header_menu.py
0 → 100644
View file @
a169b47c
#-*- coding: utf-8 -*-
"""
Course Header Menu Tests.
"""
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
FEATURES_WITH_CERTS_ENABLED
=
settings
.
FEATURES
.
copy
()
FEATURES_WITH_CERTS_ENABLED
[
'CERTIFICATES_HTML_VIEW'
]
=
True
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
class
TestHeaderMenu
(
CourseTestCase
):
"""
Unit tests for the course header menu.
"""
def
setUp
(
self
):
"""
Set up the for the course header menu tests.
"""
super
(
TestHeaderMenu
,
self
)
.
setUp
()
def
test_header_menu_without_web_certs_enabled
(
self
):
"""
Tests course header menu should not have `Certificates` menu item
if course has not web/HTML certificates enabled.
"""
outline_url
=
reverse_course_url
(
'course_handler'
,
self
.
course
.
id
)
resp
=
self
.
client
.
get
(
outline_url
,
HTTP_ACCEPT
=
'text/html'
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertNotContains
(
resp
,
'<li class="nav-item nav-course-settings-certificates">'
)
def
test_header_menu_with_web_certs_enabled
(
self
):
"""
Tests course header menu should have `Certificates` menu item
if course has web/HTML certificates enabled.
"""
self
.
course
.
cert_html_view_enabled
=
True
self
.
save_course
()
outline_url
=
reverse_course_url
(
'course_handler'
,
self
.
course
.
id
)
resp
=
self
.
client
.
get
(
outline_url
,
HTTP_ACCEPT
=
'text/html'
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertContains
(
resp
,
'<li class="nav-item nav-course-settings-certificates">'
)
cms/templates/widgets/header.html
View file @
a169b47c
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
from
django
.
core
.
urlresolvers
import
reverse
from
django
.
core
.
urlresolvers
import
reverse
from
django
.
utils
.
translation
import
ugettext
as
_
from
django
.
utils
.
translation
import
ugettext
as
_
from
contentstore
.
context_processors
import
doc_url
from
contentstore
.
context_processors
import
doc_url
from
student
.
roles
import
CourseCreatorRole
,
CourseInstructorRole
,
CourseStaffRole
%
>
%
>
<
%
page
args=
"online_help_token"
/>
<
%
page
args=
"online_help_token"
/>
...
@@ -36,12 +35,10 @@
...
@@ -36,12 +35,10 @@
grading_url =
reverse('contentstore.views.grading_handler',
kwargs=
{'course_key_string':
unicode
(
course_key
)})
grading_url =
reverse('contentstore.views.grading_handler',
kwargs=
{'course_key_string':
unicode
(
course_key
)})
advanced_settings_url =
reverse('contentstore.views.advanced_settings_handler',
kwargs=
{'course_key_string':
unicode
(
course_key
)})
advanced_settings_url =
reverse('contentstore.views.advanced_settings_handler',
kwargs=
{'course_key_string':
unicode
(
course_key
)})
tabs_url =
reverse('contentstore.views.tabs_handler',
kwargs=
{'course_key_string':
unicode
(
course_key
)})
tabs_url =
reverse('contentstore.views.tabs_handler',
kwargs=
{'course_key_string':
unicode
(
course_key
)})
certificates_url =
''
if
settings
.
FEATURES
.
get
("
CERTIFICATES_HTML_VIEW
")
and
context_course
.
cert_html_view_enabled:
certificates_url =
reverse('contentstore.views.certificates.certificates_list_handler',
kwargs=
{'course_key_string':
unicode
(
course_key
)})
%
>
%
>
% if settings.FEATURES.get("CERTIFICATES_HTML_VIEW") and context_course:
<
%
certificates_url =
reverse('contentstore.views.certificates.certificates_list_handler',
kwargs=
{'course_key_string':
unicode
(
course_key
)})
%
>
% endif
<h2
class=
"info-course"
>
<h2
class=
"info-course"
>
<span
class=
"sr"
>
${_("Current Course:")}
</span>
<span
class=
"sr"
>
${_("Current Course:")}
</span>
<a
class=
"course-link"
href=
"${index_url}"
>
<a
class=
"course-link"
href=
"${index_url}"
>
...
@@ -105,11 +102,7 @@
...
@@ -105,11 +102,7 @@
<li
class=
"nav-item nav-course-settings-advanced"
>
<li
class=
"nav-item nav-course-settings-advanced"
>
<a
href=
"${advanced_settings_url}"
>
${_("Advanced Settings")}
</a>
<a
href=
"${advanced_settings_url}"
>
${_("Advanced Settings")}
</a>
</li>
</li>
% if settings.FEATURES.get('CERTIFICATES_HTML_VIEW', False) and \
% if certificates_url:
(user.is_superuser or user.is_staff or \
CourseCreatorRole(course_key).has_user(user) or \
CourseInstructorRole(course_key).has_user(user) or \
CourseStaffRole(course_key).has_user(user)):
<li
class=
"nav-item nav-course-settings-certificates"
>
<li
class=
"nav-item nav-course-settings-certificates"
>
<a
href=
"${certificates_url}"
>
${_("Certificates")}
</a>
<a
href=
"${certificates_url}"
>
${_("Certificates")}
</a>
</li>
</li>
...
...
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