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
48a5b954
Commit
48a5b954
authored
Feb 24, 2016
by
Hassan
Committed by
Hassan Javeed
Mar 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use CourseOverview for dump_course_ids
parent
04cadf79
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
32 deletions
+4
-32
lms/djangoapps/courseware/management/commands/dump_course_ids.py
+2
-12
lms/djangoapps/courseware/management/commands/tests/test_dump_course.py
+2
-20
No files found.
lms/djangoapps/courseware/management/commands/dump_course_ids.py
View file @
48a5b954
...
@@ -6,6 +6,7 @@ from textwrap import dedent
...
@@ -6,6 +6,7 @@ from textwrap import dedent
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
...
@@ -24,17 +25,6 @@ class Command(BaseCommand):
...
@@ -24,17 +25,6 @@ class Command(BaseCommand):
)
)
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
store
=
modulestore
()
output
=
u'
\n
'
.
join
(
unicode
(
course_overview
.
id
)
for
course_overview
in
CourseOverview
.
get_all_courses
())
+
'
\n
'
name
=
options
[
'modulestore'
]
if
name
!=
'default'
:
# since a store type is given, get that specific store
if
hasattr
(
store
,
'_get_modulestore_by_type'
):
store
=
store
.
_get_modulestore_by_type
(
name
)
if
store
.
get_modulestore_type
()
!=
name
:
raise
CommandError
(
"Modulestore {} not found"
.
format
(
name
))
if
store
is
None
:
raise
CommandError
(
"Unknown modulestore {}"
.
format
(
name
))
output
=
u'
\n
'
.
join
(
unicode
(
course
.
id
)
for
course
in
store
.
get_courses
())
+
'
\n
'
return
output
return
output
lms/djangoapps/courseware/management/commands/tests/test_dump_course.py
View file @
48a5b954
...
@@ -25,14 +25,6 @@ from xmodule.modulestore.xml_importer import import_course_from_xml
...
@@ -25,14 +25,6 @@ from xmodule.modulestore.xml_importer import import_course_from_xml
DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
XML_COURSE_DIRS
=
[
'toy'
,
'simple'
]
XML_COURSE_DIRS
=
[
'toy'
,
'simple'
]
MAPPINGS
=
{
'edX/toy/2012_Fall'
:
'xml'
,
'edX/simple/2012_Fall'
:
'xml'
,
}
TEST_DATA_MIXED_XML_MODULESTORE
=
mixed_store_config
(
DATA_DIR
,
MAPPINGS
,
include_xml
=
True
,
xml_source_dirs
=
XML_COURSE_DIRS
,
)
@attr
(
'shard_1'
)
@attr
(
'shard_1'
)
...
@@ -59,6 +51,7 @@ class CommandsTestBase(ModuleStoreTestCase):
...
@@ -59,6 +51,7 @@ class CommandsTestBase(ModuleStoreTestCase):
# Add a course with a unicode name.
# Add a course with a unicode name.
unique_org
=
factory
.
Sequence
(
lambda
n
:
u'ëḋẌ.
%
d'
%
n
)
unique_org
=
factory
.
Sequence
(
lambda
n
:
u'ëḋẌ.
%
d'
%
n
)
CourseFactory
.
create
(
CourseFactory
.
create
(
emit_signals
=
True
,
org
=
unique_org
,
org
=
unique_org
,
course
=
u'śíḿṕĺé'
,
course
=
u'śíḿṕĺé'
,
display_name
=
u'2012_Fáĺĺ'
,
display_name
=
u'2012_Fáĺĺ'
,
...
@@ -82,10 +75,8 @@ class CommandsTestBase(ModuleStoreTestCase):
...
@@ -82,10 +75,8 @@ class CommandsTestBase(ModuleStoreTestCase):
return
out
.
read
()
return
out
.
read
()
def
test_dump_course_ids
(
self
):
def
test_dump_course_ids
(
self
):
kwargs
=
{
'modulestore'
:
'default'
}
output
=
self
.
call_command
(
'dump_course_ids'
)
output
=
self
.
call_command
(
'dump_course_ids'
,
**
kwargs
)
dumped_courses
=
output
.
decode
(
'utf-8'
)
.
strip
()
.
split
(
'
\n
'
)
dumped_courses
=
output
.
decode
(
'utf-8'
)
.
strip
()
.
split
(
'
\n
'
)
course_ids
=
{
unicode
(
course_id
)
for
course_id
in
self
.
loaded_courses
}
course_ids
=
{
unicode
(
course_id
)
for
course_id
in
self
.
loaded_courses
}
dumped_ids
=
set
(
dumped_courses
)
dumped_ids
=
set
(
dumped_courses
)
self
.
assertEqual
(
course_ids
,
dumped_ids
)
self
.
assertEqual
(
course_ids
,
dumped_ids
)
...
@@ -205,15 +196,6 @@ class CommandsTestBase(ModuleStoreTestCase):
...
@@ -205,15 +196,6 @@ class CommandsTestBase(ModuleStoreTestCase):
assert_in
(
'edX-simple-2012_Fall/sequential/Lecture_2.xml'
,
names
)
assert_in
(
'edX-simple-2012_Fall/sequential/Lecture_2.xml'
,
names
)
class
CommandsXMLTestCase
(
CommandsTestBase
):
"""
Test case for management commands with the xml modulestore present.
"""
MODULESTORE
=
TEST_DATA_MIXED_XML_MODULESTORE
__test__
=
True
class
CommandsMongoTestCase
(
CommandsTestBase
):
class
CommandsMongoTestCase
(
CommandsTestBase
):
"""
"""
Test case for management commands using the mixed mongo modulestore with old mongo as the default.
Test case for management commands using the mixed mongo modulestore with old mongo as the default.
...
...
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