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
18f69f3b
Commit
18f69f3b
authored
Jun 16, 2015
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8536 from edx/diana/handle-hidden-tabs
Ensure that is_hidden does not affect equality checks.
parents
5ceea7a0
72a0d195
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
cms/djangoapps/contentstore/tests/test_course_settings.py
+18
-0
common/lib/xmodule/xmodule/tabs.py
+1
-3
No files found.
cms/djangoapps/contentstore/tests/test_course_settings.py
View file @
18f69f3b
...
...
@@ -973,6 +973,24 @@ class CourseMetadataEditingTest(CourseTestCase):
self
.
assertNotIn
(
peer_grading_tab
,
course
.
tabs
)
self
.
assertNotIn
(
notes_tab
,
course
.
tabs
)
def
mark_wiki_as_hidden
(
self
,
tabs
):
""" Mark the wiki tab as hidden. """
for
tab
in
tabs
:
if
tab
.
type
==
'wiki'
:
tab
[
'is_hidden'
]
=
True
return
tabs
def
test_advanced_components_munge_tabs_hidden_tabs
(
self
):
updated_tabs
=
self
.
mark_wiki_as_hidden
(
self
.
course
.
tabs
)
self
.
course
.
tabs
=
updated_tabs
modulestore
()
.
update_item
(
self
.
course
,
self
.
user
.
id
)
self
.
client
.
ajax_post
(
self
.
course_setting_url
,
{
ADVANCED_COMPONENT_POLICY_KEY
:
{
"value"
:
[
"notes"
]}
})
course
=
modulestore
()
.
get_course
(
self
.
course
.
id
)
notes_tab
=
{
"type"
:
"notes"
,
"name"
:
"My Notes"
}
self
.
assertIn
(
notes_tab
,
course
.
tabs
)
class
CourseGraderUpdatesTest
(
CourseTestCase
):
"""
...
...
common/lib/xmodule/xmodule/tabs.py
View file @
18f69f3b
...
...
@@ -138,10 +138,8 @@ class CourseTab(object):
# allow tabs without names; if a name is required, its presence was checked in the validator.
name_is_eq
=
(
other
.
get
(
'name'
)
is
None
or
self
.
name
==
other
[
'name'
])
is_hidden_eq
=
self
.
is_hidden
==
other
.
get
(
'is_hidden'
,
False
)
# only compare the persisted/serialized members: 'type' and 'name'
return
self
.
type
==
other
.
get
(
'type'
)
and
name_is_eq
and
is_hidden_eq
return
self
.
type
==
other
.
get
(
'type'
)
and
name_is_eq
def
__ne__
(
self
,
other
):
"""
...
...
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