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
c292f3c6
Commit
c292f3c6
authored
Aug 08, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests to show that reading a structure before versioning it breaks versioning
parent
4f4ef959
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py
+19
-0
No files found.
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py
View file @
c292f3c6
...
...
@@ -13,6 +13,7 @@ class TestBulkWriteMixin(unittest.TestCase):
def
setUp
(
self
):
super
(
TestBulkWriteMixin
,
self
)
.
setUp
()
self
.
bulk
=
BulkWriteMixin
()
self
.
bulk
.
SCHEMA_VERSION
=
1
self
.
clear_cache
=
self
.
bulk
.
_clear_cache
=
Mock
(
name
=
'_clear_cache'
)
self
.
conn
=
self
.
bulk
.
db_connection
=
MagicMock
(
name
=
'db_connection'
,
spec
=
MongoConnection
)
...
...
@@ -165,6 +166,12 @@ class TestBulkWriteMixinClosed(TestBulkWriteMixin):
self
.
conn
.
mock_calls
)
def
test_version_structure_creates_new_version
(
self
):
self
.
assertNotEquals
(
self
.
bulk
.
version_structure
(
self
.
course_key
,
self
.
structure
,
'user_id'
)[
'_id'
],
self
.
structure
[
'_id'
]
)
class
TestBulkWriteMixinClosedAfterPrevTransaction
(
TestBulkWriteMixinClosed
,
TestBulkWriteMixinPreviousTransaction
):
"""
Test that operations on with a closed transaction aren't affected by a previously executed transaction
...
...
@@ -257,7 +264,19 @@ class TestBulkWriteMixinOpen(TestBulkWriteMixin):
self
.
assertEquals
(
self
.
conn
.
get_course_index
.
call_count
,
1
)
self
.
assertEquals
(
self
.
index_entry
,
result
)
def
test_version_structure_creates_new_version_before_read
(
self
):
self
.
assertNotEquals
(
self
.
bulk
.
version_structure
(
self
.
course_key
,
self
.
structure
,
'user_id'
)[
'_id'
],
self
.
structure
[
'_id'
]
)
def
test_version_structure_creates_new_version_after_read
(
self
):
self
.
conn
.
get_structure
.
return_value
=
copy
.
deepcopy
(
self
.
structure
)
self
.
bulk
.
get_structure
(
self
.
course_key
,
self
.
structure
[
'_id'
])
self
.
assertNotEquals
(
self
.
bulk
.
version_structure
(
self
.
course_key
,
self
.
structure
,
'user_id'
)[
'_id'
],
self
.
structure
[
'_id'
]
)
class
TestBulkWriteMixinOpenAfterPrevTransaction
(
TestBulkWriteMixinOpen
,
TestBulkWriteMixinPreviousTransaction
):
"""
...
...
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