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
775b50a7
Commit
775b50a7
authored
Aug 08, 2014
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address code coverage and quality.
parent
934d4e8a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
cms/djangoapps/contentstore/tests/test_import.py
+2
-1
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
+0
-1
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+19
-1
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+1
-0
No files found.
cms/djangoapps/contentstore/tests/test_import.py
View file @
775b50a7
...
...
@@ -14,7 +14,8 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore.tests.factories
import
check_exact_number_of_calls
,
check_number_of_calls
from
xmodule.modulestore.exceptions
import
DuplicateCourseError
from
xmodule.modulestore.tests.factories
import
check_exact_number_of_calls
,
check_number_of_calls
,
CourseFactory
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
AssetLocation
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.exceptions
import
NotFoundError
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
View file @
775b50a7
...
...
@@ -297,4 +297,3 @@ class DraftVersioningModuleStore(ModuleStoreDraftAndPublished, SplitMongoModuleS
Return the version of the given database representation of a block.
"""
return
block
[
'edit_info'
]
.
get
(
'source_version'
,
block
[
'edit_info'
][
'update_version'
])
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
775b50a7
...
...
@@ -544,6 +544,13 @@ class TestMixedModuleStore(unittest.TestCase):
self
.
assertIn
(
self
.
course_locations
[
self
.
XML_COURSEID1
],
course_ids
)
self
.
assertIn
(
self
.
course_locations
[
self
.
XML_COURSEID2
],
course_ids
)
with
self
.
store
.
branch_setting
(
ModuleStoreEnum
.
Branch
.
draft_preferred
):
draft_courses
=
self
.
store
.
get_courses
(
remove_branch
=
True
)
with
self
.
store
.
branch_setting
(
ModuleStoreEnum
.
Branch
.
published_only
):
published_courses
=
self
.
store
.
get_courses
(
remove_branch
=
True
)
self
.
assertEquals
([
c
.
id
for
c
in
draft_courses
],
[
c
.
id
for
c
in
published_courses
])
def
test_xml_get_courses
(
self
):
"""
Test that the xml modulestore only loaded the courses from the maps.
...
...
@@ -1229,7 +1236,7 @@ class TestMixedModuleStore(unittest.TestCase):
with
self
.
store
.
default_store
(
default_ms
):
self
.
verify_default_store
(
default_ms
)
def
test_
nested_default_store
(
self
):
def
test_
default_store_nested
(
self
):
"""
Test the default store context manager, nested within one another
"""
...
...
@@ -1245,6 +1252,17 @@ class TestMixedModuleStore(unittest.TestCase):
self
.
verify_default_store
(
ModuleStoreEnum
.
Type
.
split
)
self
.
verify_default_store
(
ModuleStoreEnum
.
Type
.
mongo
)
def
test_default_store_fake
(
self
):
"""
Test the default store context manager, asking for a fake store
"""
# initialize the mixed modulestore
self
.
_initialize_mixed
()
fake_store
=
"fake"
with
self
.
assertRaisesRegexp
(
Exception
,
"Cannot find store of type {}"
.
format
(
fake_store
)):
with
self
.
store
.
default_store
(
fake_store
):
pass
# pragma: no cover
#=============================================================================================================
# General utils for not using django settings
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
775b50a7
...
...
@@ -176,6 +176,7 @@ def import_from_xml(
store
.
create_course
(
dest_course_id
.
org
,
dest_course_id
.
course
,
dest_course_id
.
run
,
user_id
)
except
DuplicateCourseError
:
# course w/ same org and course exists
# The Mongo modulestore checks *with* the run in has_course, but not in create_course.
log
.
debug
(
"Skipping import of course with id, {0},"
"since it collides with an existing one"
.
format
(
dest_course_id
)
...
...
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