本文整理汇总了Python中mock.call.insert_structure函数的典型用法代码示例。如果您正苦于以下问题:Python insert_structure函数的具体用法?Python insert_structure怎么用?Python insert_structure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insert_structure函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_write_multiple_structures_on_close
def test_write_multiple_structures_on_close(self):
self.conn.get_course_index.return_value = None
self.bulk._begin_bulk_operation(self.course_key)
self.conn.reset_mock()
self.bulk.update_structure(self.course_key.replace(branch='a'), self.structure)
other_structure = {'another': 'structure', '_id': ObjectId()}
self.bulk.update_structure(self.course_key.replace(branch='b'), other_structure)
self.assertConnCalls()
self.bulk._end_bulk_operation(self.course_key)
self.assertItemsEqual(
[call.insert_structure(self.structure), call.insert_structure(other_structure)],
self.conn.mock_calls
)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:13,代码来源:test_split_modulestore_bulk_operations.py
示例2: test_no_bulk_write_structure
def test_no_bulk_write_structure(self):
# Writing a structure when no bulk operation is active should just
# call through to the db_connection. It should also clear the
# system cache
self.bulk.update_structure(self.course_key, self.structure)
self.assertConnCalls(call.insert_structure(self.structure, self.course_key))
self.clear_cache.assert_called_once_with(self.structure["_id"])
开发者ID:edx,项目名称:edx-platform,代码行数:7,代码来源:test_split_modulestore_bulk_operations.py
示例3: test_write_structure_on_close
def test_write_structure_on_close(self):
self.conn.get_course_index.return_value = None
self.bulk._begin_bulk_operation(self.course_key)
self.conn.reset_mock()
self.bulk.update_structure(self.course_key, self.structure)
self.assertConnCalls()
self.bulk._end_bulk_operation(self.course_key)
self.assertConnCalls(call.insert_structure(self.structure, self.course_key))
开发者ID:edx,项目名称:edx-platform,代码行数:8,代码来源:test_split_modulestore_bulk_operations.py
示例4: test_write_index_and_multiple_structures_on_close
def test_write_index_and_multiple_structures_on_close(self):
original_index = {'versions': {'a': ObjectId(), 'b': ObjectId()}}
self.conn.get_course_index.return_value = copy.deepcopy(original_index)
self.bulk._begin_bulk_operation(self.course_key)
self.conn.reset_mock()
self.bulk.update_structure(self.course_key.replace(branch='a'), self.structure)
other_structure = {'another': 'structure', '_id': ObjectId()}
self.bulk.update_structure(self.course_key.replace(branch='b'), other_structure)
self.bulk.insert_course_index(self.course_key, {'versions': {'a': self.structure['_id'], 'b': other_structure['_id']}})
self.bulk._end_bulk_operation(self.course_key)
self.assertItemsEqual(
[
call.insert_structure(self.structure),
call.insert_structure(other_structure),
call.update_course_index(
{'versions': {'a': self.structure['_id'], 'b': other_structure['_id']}},
from_index=original_index
)
],
self.conn.mock_calls
)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:21,代码来源:test_split_modulestore_bulk_operations.py
示例5: test_write_index_and_multiple_structures_on_close
def test_write_index_and_multiple_structures_on_close(self):
original_index = {"versions": {"a": ObjectId(), "b": ObjectId()}}
self.conn.get_course_index.return_value = copy.deepcopy(original_index)
self.bulk._begin_bulk_operation(self.course_key)
self.conn.reset_mock()
self.bulk.update_structure(self.course_key.replace(branch="a"), self.structure)
other_structure = {"another": "structure", "_id": ObjectId()}
self.bulk.update_structure(self.course_key.replace(branch="b"), other_structure)
self.bulk.insert_course_index(
self.course_key, {"versions": {"a": self.structure["_id"], "b": other_structure["_id"]}}
)
self.bulk._end_bulk_operation(self.course_key)
self.assertItemsEqual(
[
call.insert_structure(self.structure, self.course_key),
call.insert_structure(other_structure, self.course_key),
call.update_course_index(
{"versions": {"a": self.structure["_id"], "b": other_structure["_id"]}},
from_index=original_index,
course_context=self.course_key,
),
],
self.conn.mock_calls,
)
开发者ID:edx,项目名称:edx-platform,代码行数:24,代码来源:test_split_modulestore_bulk_operations.py
示例6: test_write_index_and_structure_on_close
def test_write_index_and_structure_on_close(self):
original_index = {'versions': {}}
self.conn.get_course_index.return_value = copy.deepcopy(original_index)
self.bulk._begin_bulk_operation(self.course_key)
self.conn.reset_mock()
self.bulk.update_structure(self.course_key, self.structure)
self.bulk.insert_course_index(self.course_key, {'versions': {self.course_key.branch: self.structure['_id']}})
self.assertConnCalls()
self.bulk._end_bulk_operation(self.course_key)
self.assertConnCalls(
call.insert_structure(self.structure),
call.update_course_index(
{'versions': {self.course_key.branch: self.structure['_id']}},
from_index=original_index
)
)
开发者ID:CDOT-EDX,项目名称:edx-platform,代码行数:16,代码来源:test_split_modulestore_bulk_operations.py
注:本文中的mock.call.insert_structure函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论