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
48bdeeea
Commit
48bdeeea
authored
Sep 03, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5052 from edx/split/bulk-rerun-LMS-11332
Enable bulk operations on split
parents
6261d9c8
f70e7025
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
24 deletions
+48
-24
cms/djangoapps/contentstore/tests/test_contentstore.py
+39
-23
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+2
-1
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py
+7
-0
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
48bdeeea
...
@@ -1612,17 +1612,15 @@ class RerunCourseTest(ContentStoreTestCase):
...
@@ -1612,17 +1612,15 @@ class RerunCourseTest(ContentStoreTestCase):
self
.
assertEqual
(
len
(
self
.
get_course_listing_elements
(
course_listing
,
course_key
)),
0
)
self
.
assertEqual
(
len
(
self
.
get_course_listing_elements
(
course_listing
,
course_key
)),
0
)
self
.
assertEqual
(
len
(
self
.
get_unsucceeded_course_action_elements
(
course_listing
,
course_key
)),
1
)
self
.
assertEqual
(
len
(
self
.
get_unsucceeded_course_action_elements
(
course_listing
,
course_key
)),
1
)
def
test_rerun_course_success
(
self
):
def
verify_rerun_course
(
self
,
source_course_key
,
destination_course_key
,
destination_display_name
):
"""
source_course
=
CourseFactory
.
create
()
Verify the contents of the course rerun action
destination_course_key
=
self
.
post_rerun_request
(
source_course
.
id
)
"""
# Verify the contents of the course rerun action
rerun_state
=
CourseRerunState
.
objects
.
find_first
(
course_key
=
destination_course_key
)
rerun_state
=
CourseRerunState
.
objects
.
find_first
(
course_key
=
destination_course_key
)
expected_states
=
{
expected_states
=
{
'state'
:
CourseRerunUIStateManager
.
State
.
SUCCEEDED
,
'state'
:
CourseRerunUIStateManager
.
State
.
SUCCEEDED
,
'display_name'
:
self
.
destination_course_data
[
'display_name'
]
,
'display_name'
:
destination_display_name
,
'source_course_key'
:
source_course
.
id
,
'source_course_key'
:
source_course
_key
,
'course_key'
:
destination_course_key
,
'course_key'
:
destination_course_key
,
'should_display'
:
True
,
'should_display'
:
True
,
}
}
...
@@ -1633,28 +1631,46 @@ class RerunCourseTest(ContentStoreTestCase):
...
@@ -1633,28 +1631,46 @@ class RerunCourseTest(ContentStoreTestCase):
self
.
assertTrue
(
CourseEnrollment
.
is_enrolled
(
self
.
user
,
destination_course_key
))
self
.
assertTrue
(
CourseEnrollment
.
is_enrolled
(
self
.
user
,
destination_course_key
))
# Verify both courses are in the course listing section
# Verify both courses are in the course listing section
self
.
assertInCourseListing
(
source_course
.
id
)
self
.
assertInCourseListing
(
source_course
_key
)
self
.
assertInCourseListing
(
destination_course_key
)
self
.
assertInCourseListing
(
destination_course_key
)
@skipIf
(
not
settings
.
FEATURES
.
get
(
'ALLOW_COURSE_RERUNS'
,
False
),
"ALLOW_COURSE_RERUNS are not enabled"
)
def
test_rerun_course_success
(
self
):
source_course
=
CourseFactory
.
create
()
destination_course_key
=
self
.
post_rerun_request
(
source_course
.
id
)
self
.
verify_rerun_course
(
source_course
.
id
,
destination_course_key
,
self
.
destination_course_data
[
'display_name'
])
def
test_rerun_of_rerun
(
self
):
source_course
=
CourseFactory
.
create
()
rerun_course_key
=
self
.
post_rerun_request
(
source_course
.
id
)
rerun_of_rerun_data
=
{
'org'
:
rerun_course_key
.
org
,
'number'
:
rerun_course_key
.
course
,
'display_name'
:
'rerun of rerun'
,
'run'
:
'rerun2'
}
rerun_of_rerun_course_key
=
self
.
post_rerun_request
(
rerun_course_key
,
rerun_of_rerun_data
)
self
.
verify_rerun_course
(
rerun_course_key
,
rerun_of_rerun_course_key
,
rerun_of_rerun_data
[
'display_name'
])
def
test_rerun_course_fail_no_source_course
(
self
):
def
test_rerun_course_fail_no_source_course
(
self
):
existent_course_key
=
CourseFactory
.
create
()
.
id
with
mock
.
patch
.
dict
(
'django.conf.settings.FEATURES'
,
{
'ALLOW_COURSE_RERUNS'
:
True
}):
non_existent_course_key
=
CourseLocator
(
"org"
,
"non_existent_course"
,
"non_existent_run"
)
existent_course_key
=
CourseFactory
.
create
()
.
id
destination_course_key
=
self
.
post_rerun_request
(
non_existent_course_key
)
non_existent_course_key
=
CourseLocator
(
"org"
,
"non_existent_course"
,
"non_existent_run"
)
destination_course_key
=
self
.
post_rerun_request
(
non_existent_course_key
)
# Verify that the course rerun action is marked failed
# Verify that the course rerun action is marked failed
rerun_state
=
CourseRerunState
.
objects
.
find_first
(
course_key
=
destination_course_key
)
rerun_state
=
CourseRerunState
.
objects
.
find_first
(
course_key
=
destination_course_key
)
self
.
assertEquals
(
rerun_state
.
state
,
CourseRerunUIStateManager
.
State
.
FAILED
)
self
.
assertEquals
(
rerun_state
.
state
,
CourseRerunUIStateManager
.
State
.
FAILED
)
self
.
assertIn
(
"Cannot find a course at"
,
rerun_state
.
message
)
self
.
assertIn
(
"Cannot find a course at"
,
rerun_state
.
message
)
# Verify that the creator is not enrolled in the course.
# Verify that the creator is not enrolled in the course.
self
.
assertFalse
(
CourseEnrollment
.
is_enrolled
(
self
.
user
,
non_existent_course_key
))
self
.
assertFalse
(
CourseEnrollment
.
is_enrolled
(
self
.
user
,
non_existent_course_key
))
# Verify that the existing course continues to be in the course listings
# Verify that the existing course continues to be in the course listings
self
.
assertInCourseListing
(
existent_course_key
)
self
.
assertInCourseListing
(
existent_course_key
)
# Verify that the failed course is NOT in the course listings
# Verify that the failed course is NOT in the course listings
self
.
assertInUnsucceededCourseActions
(
destination_course_key
)
self
.
assertInUnsucceededCourseActions
(
destination_course_key
)
def
test_rerun_course_fail_duplicate_course
(
self
):
def
test_rerun_course_fail_duplicate_course
(
self
):
existent_course_key
=
CourseFactory
.
create
()
.
id
existent_course_key
=
CourseFactory
.
create
()
.
id
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
48bdeeea
...
@@ -168,7 +168,8 @@ class BulkWriteRecord(object):
...
@@ -168,7 +168,8 @@ class BulkWriteRecord(object):
return
self
.
structures
.
get
(
self
.
index
.
get
(
'versions'
,
{})
.
get
(
branch
))
return
self
.
structures
.
get
(
self
.
index
.
get
(
'versions'
,
{})
.
get
(
branch
))
def
set_structure_for_branch
(
self
,
branch
,
structure
):
def
set_structure_for_branch
(
self
,
branch
,
structure
):
self
.
index
.
get
(
'versions'
,
{})[
branch
]
=
structure
[
'_id'
]
if
self
.
index
is
not
None
:
self
.
index
.
setdefault
(
'versions'
,
{})[
branch
]
=
structure
[
'_id'
]
self
.
structures
[
structure
[
'_id'
]]
=
structure
self
.
structures
[
structure
[
'_id'
]]
=
structure
def
__repr__
(
self
):
def
__repr__
(
self
):
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py
View file @
48bdeeea
...
@@ -174,6 +174,13 @@ class TestBulkWriteMixinClosed(TestBulkWriteMixin):
...
@@ -174,6 +174,13 @@ class TestBulkWriteMixinClosed(TestBulkWriteMixin):
self
.
structure
[
'_id'
]
self
.
structure
[
'_id'
]
)
)
def
test_version_structure_new_course
(
self
):
self
.
conn
.
get_course_index
.
return_value
=
None
self
.
bulk
.
_begin_bulk_operation
(
self
.
course_key
)
version_result
=
self
.
bulk
.
version_structure
(
self
.
course_key
,
self
.
structure
,
'user_id'
)
get_result
=
self
.
bulk
.
get_structure
(
self
.
course_key
,
version_result
[
'_id'
])
self
.
assertEquals
(
version_result
,
get_result
)
class
TestBulkWriteMixinClosedAfterPrevTransaction
(
TestBulkWriteMixinClosed
,
TestBulkWriteMixinPreviousTransaction
):
class
TestBulkWriteMixinClosedAfterPrevTransaction
(
TestBulkWriteMixinClosed
,
TestBulkWriteMixinPreviousTransaction
):
"""
"""
Test that operations on with a closed transaction aren't affected by a previously executed transaction
Test that operations on with a closed transaction aren't affected by a previously executed transaction
...
...
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