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
478f3cc8
Commit
478f3cc8
authored
Aug 19, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Persist static_tab name.
STUD-663.
parent
424570c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
+25
-0
common/lib/xmodule/xmodule/modulestore/xml.py
+1
-0
No files found.
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
View file @
478f3cc8
...
@@ -120,8 +120,30 @@ class TestMongoModuleStore(object):
...
@@ -120,8 +120,30 @@ class TestMongoModuleStore(object):
'{0} is a template course'
.
format
(
course
)
'{0} is a template course'
.
format
(
course
)
)
)
def
test_static_tab_names
(
self
):
courses
=
self
.
store
.
get_courses
()
def
get_tab_name
(
index
):
"""
Helper function for pulling out the name of a given static tab.
Assumes the information is desired for courses[1] ('toy' course).
"""
return
courses
[
1
]
.
tabs
[
index
][
'name'
]
# There was a bug where model.save was not getting called after the static tab name
# was set set for tabs that have a URL slug. 'Syllabus' and 'Resources' fall into that
# category, but for completeness, I'm also testing 'Course Info' and 'Discussion' (no url slug).
assert_equals
(
'Course Info'
,
get_tab_name
(
1
))
assert_equals
(
'Syllabus'
,
get_tab_name
(
2
))
assert_equals
(
'Resources'
,
get_tab_name
(
3
))
assert_equals
(
'Discussion'
,
get_tab_name
(
4
))
class
TestMongoKeyValueStore
(
object
):
class
TestMongoKeyValueStore
(
object
):
"""
Tests for MongoKeyValueStore.
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
data
=
{
'foo'
:
'foo_value'
}
self
.
data
=
{
'foo'
:
'foo_value'
}
...
@@ -131,6 +153,9 @@ class TestMongoKeyValueStore(object):
...
@@ -131,6 +153,9 @@ class TestMongoKeyValueStore(object):
self
.
kvs
=
MongoKeyValueStore
(
self
.
data
,
self
.
children
,
self
.
metadata
,
self
.
location
,
'category'
)
self
.
kvs
=
MongoKeyValueStore
(
self
.
data
,
self
.
children
,
self
.
metadata
,
self
.
location
,
'category'
)
def
_check_read
(
self
,
key
,
expected_value
):
def
_check_read
(
self
,
key
,
expected_value
):
"""
Asserts the get and has methods.
"""
assert_equals
(
expected_value
,
self
.
kvs
.
get
(
key
))
assert_equals
(
expected_value
,
self
.
kvs
.
get
(
key
))
assert
self
.
kvs
.
has
(
key
)
assert
self
.
kvs
.
has
(
key
)
...
...
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
478f3cc8
...
@@ -479,6 +479,7 @@ class XMLModuleStore(ModuleStoreBase):
...
@@ -479,6 +479,7 @@ class XMLModuleStore(ModuleStoreBase):
if
tab
.
get
(
'url_slug'
)
==
slug
:
if
tab
.
get
(
'url_slug'
)
==
slug
:
module
.
display_name
=
tab
[
'name'
]
module
.
display_name
=
tab
[
'name'
]
module
.
data_dir
=
course_dir
module
.
data_dir
=
course_dir
module
.
save
()
self
.
modules
[
course_descriptor
.
id
][
module
.
location
]
=
module
self
.
modules
[
course_descriptor
.
id
][
module
.
location
]
=
module
except
Exception
,
e
:
except
Exception
,
e
:
logging
.
exception
(
"Failed to load {0}. Skipping... Exception: {1}"
.
format
(
filepath
,
str
(
e
)))
logging
.
exception
(
"Failed to load {0}. Skipping... Exception: {1}"
.
format
(
filepath
,
str
(
e
)))
...
...
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