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
c7f2f277
Commit
c7f2f277
authored
Sep 06, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug and add unit test
parent
12e82221
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletions
+38
-1
cms/djangoapps/contentstore/tests/test_contentstore.py
+37
-0
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+1
-1
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
c7f2f277
...
@@ -348,6 +348,43 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
...
@@ -348,6 +348,43 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
self
.
assertEqual
(
course
.
tabs
,
expected_tabs
)
self
.
assertEqual
(
course
.
tabs
,
expected_tabs
)
def
test_create_static_tab_and_rename
(
self
):
module_store
=
modulestore
(
'direct'
)
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'999'
,
display_name
=
'Robot Super Course'
)
course_location
=
Location
([
'i4x'
,
'edX'
,
'999'
,
'course'
,
'Robot_Super_Course'
,
None
])
item
=
ItemFactory
.
create
(
parent_location
=
course_location
,
category
=
'static_tab'
,
display_name
=
"My Tab"
)
course
=
module_store
.
get_item
(
course_location
)
expected_tabs
=
[]
expected_tabs
.
append
({
u'type'
:
u'courseware'
})
expected_tabs
.
append
({
u'type'
:
u'course_info'
,
u'name'
:
u'Course Info'
})
expected_tabs
.
append
({
u'type'
:
u'textbooks'
})
expected_tabs
.
append
({
u'type'
:
u'discussion'
,
u'name'
:
u'Discussion'
})
expected_tabs
.
append
({
u'type'
:
u'wiki'
,
u'name'
:
u'Wiki'
})
expected_tabs
.
append
({
u'type'
:
u'progress'
,
u'name'
:
u'Progress'
})
expected_tabs
.
append
({
u'type'
:
u'static_tab'
,
u'name'
:
u'My Tab'
,
u'url_slug'
:
u'My_Tab'
})
self
.
assertEqual
(
course
.
tabs
,
expected_tabs
)
item
.
display_name
=
'Updated'
item
.
save
()
module_store
.
update_metadata
(
item
.
location
,
own_metadata
(
item
))
course
=
module_store
.
get_item
(
course_location
)
expected_tabs
=
[]
expected_tabs
.
append
({
u'type'
:
u'courseware'
})
expected_tabs
.
append
({
u'type'
:
u'course_info'
,
u'name'
:
u'Course Info'
})
expected_tabs
.
append
({
u'type'
:
u'textbooks'
})
expected_tabs
.
append
({
u'type'
:
u'discussion'
,
u'name'
:
u'Discussion'
})
expected_tabs
.
append
({
u'type'
:
u'wiki'
,
u'name'
:
u'Wiki'
})
expected_tabs
.
append
({
u'type'
:
u'progress'
,
u'name'
:
u'Progress'
})
expected_tabs
.
append
({
u'type'
:
u'static_tab'
,
u'name'
:
u'Updated'
,
u'url_slug'
:
u'My_Tab'
})
self
.
assertEqual
(
course
.
tabs
,
expected_tabs
)
def
test_static_tab_reordering
(
self
):
def
test_static_tab_reordering
(
self
):
module_store
=
modulestore
(
'direct'
)
module_store
=
modulestore
(
'direct'
)
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'999'
,
display_name
=
'Robot Super Course'
)
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'999'
,
display_name
=
'Robot Super Course'
)
...
...
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
c7f2f277
...
@@ -794,7 +794,7 @@ class MongoModuleStore(ModuleStoreBase):
...
@@ -794,7 +794,7 @@ class MongoModuleStore(ModuleStoreBase):
existing_tabs
=
course
.
tabs
or
[]
existing_tabs
=
course
.
tabs
or
[]
for
tab
in
existing_tabs
:
for
tab
in
existing_tabs
:
if
tab
.
get
(
'url_slug'
)
==
loc
.
name
:
if
tab
.
get
(
'url_slug'
)
==
loc
.
name
:
tab
[
'name'
]
=
tab
.
get
(
'name'
,
metadata
.
get
(
'display_
name'
))
tab
[
'name'
]
=
metadata
.
get
(
'display_name'
,
tab
.
get
(
'
name'
))
break
break
course
.
tabs
=
existing_tabs
course
.
tabs
=
existing_tabs
# Save the updates to the course to the MongoKeyValueStore
# Save the updates to the course to the MongoKeyValueStore
...
...
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