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
9ecf2c00
Commit
9ecf2c00
authored
Mar 12, 2014
by
Carlos Andrés Rocha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support unicode in course ids when dumping all courses
Fixes: AN-657
parent
acea6c83
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
4 deletions
+21
-4
lms/djangoapps/courseware/management/commands/dump_course_ids.py
+8
-3
lms/djangoapps/courseware/management/commands/tests/__init__.py
+0
-0
lms/djangoapps/courseware/management/commands/tests/test_dump_course.py
+13
-1
No files found.
lms/djangoapps/courseware/management/commands/dump_course_ids.py
View file @
9ecf2c00
...
...
@@ -11,6 +11,9 @@ from xmodule.modulestore.django import modulestore
class
Command
(
BaseCommand
):
"""
Simple command to dump the course_ids available to the lms.
Output is UTF-8 encoded by default.
"""
help
=
dedent
(
__doc__
)
.
strip
()
option_list
=
BaseCommand
.
option_list
+
(
...
...
@@ -21,7 +24,7 @@ class Command(BaseCommand):
)
def
handle
(
self
,
*
args
,
**
options
):
output
=
[]
results
=
[]
try
:
name
=
options
[
'modulestore'
]
...
...
@@ -31,6 +34,8 @@ class Command(BaseCommand):
for
course
in
store
.
get_courses
():
course_id
=
course
.
location
.
course_id
output
.
append
(
course_id
)
results
.
append
(
course_id
)
output
=
'
\n
'
.
join
(
results
)
+
'
\n
'
return
'
\n
'
.
join
(
output
)
+
'
\n
'
return
output
.
encode
(
'utf-8'
)
lms/djangoapps/courseware/management/commands/tests/__init__.py
0 → 100644
View file @
9ecf2c00
lms/djangoapps/courseware/management/commands/tests/test_dump_course.py
View file @
9ecf2c00
# coding=utf-8
"""Tests for Django management commands"""
import
json
...
...
@@ -18,6 +20,7 @@ from courseware.tests.modulestore_config import TEST_DATA_MONGO_MODULESTORE
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.xml_importer
import
import_from_xml
DATA_DIR
=
'common/test/data/'
...
...
@@ -41,6 +44,14 @@ class CommandsTestBase(TestCase):
"""Load test courses and return list of ids"""
store
=
modulestore
()
# Add a course with a unicode name, if the modulestore
# supports adding modules.
if
hasattr
(
store
,
'create_xmodule'
):
CourseFactory
.
create
(
org
=
u'édX'
,
course
=
u'śíḿṕĺé'
,
display_name
=
u'2012_Fáĺĺ'
,
modulestore
=
store
)
courses
=
store
.
get_courses
()
if
TEST_COURSE_ID
not
in
[
c
.
id
for
c
in
courses
]:
import_from_xml
(
store
,
DATA_DIR
,
[
'toy'
,
'simple'
])
...
...
@@ -57,7 +68,8 @@ class CommandsTestBase(TestCase):
def
test_dump_course_ids
(
self
):
kwargs
=
{
'modulestore'
:
'default'
}
output
=
self
.
call_command
(
'dump_course_ids'
,
**
kwargs
)
dumped_courses
=
output
.
strip
()
.
split
(
'
\n
'
)
dumped_courses
=
output
.
decode
(
'utf-8'
)
.
strip
()
.
split
(
'
\n
'
)
self
.
assertEqual
(
self
.
loaded_courses
,
dumped_courses
)
def
test_dump_course_structure
(
self
):
...
...
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