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
f5d3d605
Commit
f5d3d605
authored
Jan 27, 2015
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test of draft content depends on old mongo.
parent
840b42a9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
+8
-3
No files found.
cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
View file @
f5d3d605
...
@@ -5,6 +5,8 @@ Integration tests for importing courses containing pure XBlocks.
...
@@ -5,6 +5,8 @@ Integration tests for importing courses containing pure XBlocks.
from
xblock.core
import
XBlock
from
xblock.core
import
XBlock
from
xblock.fields
import
String
from
xblock.fields
import
String
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.mongo.draft
import
as_draft
from
xmodule.modulestore.mongo.draft
import
as_draft
...
@@ -60,8 +62,11 @@ class XBlockImportTest(ModuleStoreTestCase):
...
@@ -60,8 +62,11 @@ class XBlockImportTest(ModuleStoreTestCase):
the expected field value set.
the expected field value set.
"""
"""
# It is necessary to use the "old mongo" modulestore because split doesn't work
# with the "has_draft" logic below.
store
=
modulestore
()
.
_get_modulestore_by_type
(
ModuleStoreEnum
.
Type
.
mongo
)
# pylint: disable=protected-access
courses
=
import_from_xml
(
courses
=
import_from_xml
(
s
elf
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
course_dir
]
s
tore
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
course_dir
],
create_course_if_not_present
=
True
)
)
xblock_location
=
courses
[
0
]
.
id
.
make_usage_key
(
'stubxblock'
,
'xblock_test'
)
xblock_location
=
courses
[
0
]
.
id
.
make_usage_key
(
'stubxblock'
,
'xblock_test'
)
...
@@ -69,12 +74,12 @@ class XBlockImportTest(ModuleStoreTestCase):
...
@@ -69,12 +74,12 @@ class XBlockImportTest(ModuleStoreTestCase):
if
has_draft
:
if
has_draft
:
xblock_location
=
as_draft
(
xblock_location
)
xblock_location
=
as_draft
(
xblock_location
)
xblock
=
s
elf
.
s
tore
.
get_item
(
xblock_location
)
xblock
=
store
.
get_item
(
xblock_location
)
self
.
assertTrue
(
isinstance
(
xblock
,
StubXBlock
))
self
.
assertTrue
(
isinstance
(
xblock
,
StubXBlock
))
self
.
assertEqual
(
xblock
.
test_field
,
expected_field_val
)
self
.
assertEqual
(
xblock
.
test_field
,
expected_field_val
)
if
has_draft
:
if
has_draft
:
draft_xblock
=
s
elf
.
s
tore
.
get_item
(
xblock_location
)
draft_xblock
=
store
.
get_item
(
xblock_location
)
self
.
assertTrue
(
getattr
(
draft_xblock
,
'is_draft'
,
False
))
self
.
assertTrue
(
getattr
(
draft_xblock
,
'is_draft'
,
False
))
self
.
assertTrue
(
isinstance
(
draft_xblock
,
StubXBlock
))
self
.
assertTrue
(
isinstance
(
draft_xblock
,
StubXBlock
))
self
.
assertEqual
(
draft_xblock
.
test_field
,
expected_field_val
)
self
.
assertEqual
(
draft_xblock
.
test_field
,
expected_field_val
)
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