Block Structure API: Replace has_block with __contains__
This commit is contained in:
@@ -88,14 +88,14 @@ class BlockNavigationTransformerCourseTestCase(ModuleStoreTestCase):
|
||||
BlockNavigationTransformer.collect(block_structure)
|
||||
block_structure._collect_requested_xblock_fields()
|
||||
|
||||
self.assertTrue(block_structure.has_block(chapter_x_key))
|
||||
self.assertIn(chapter_x_key, block_structure)
|
||||
|
||||
# transform phase
|
||||
BlockDepthTransformer().transform(usage_info=None, block_structure=block_structure)
|
||||
BlockNavigationTransformer(0).transform(usage_info=None, block_structure=block_structure)
|
||||
block_structure._prune_unreachable()
|
||||
|
||||
self.assertTrue(block_structure.has_block(chapter_x_key))
|
||||
self.assertIn(chapter_x_key, block_structure)
|
||||
|
||||
course_descendants = block_structure.get_transformer_block_field(
|
||||
course_usage_key,
|
||||
|
||||
@@ -311,7 +311,7 @@ class BlockParentsMapTestCase(TransformerRegistryTestMixin, ModuleStoreTestCase)
|
||||
for i, xblock_key in enumerate(self.xblock_keys):
|
||||
|
||||
# compute access results of the block
|
||||
block_structure_result = block_structure.has_block(xblock_key)
|
||||
block_structure_result = xblock_key in block_structure
|
||||
has_access_result = bool(has_access(user, 'load', self.get_block(i), course_key=self.course.id))
|
||||
|
||||
# compare with expected value
|
||||
|
||||
Reference in New Issue
Block a user