Block Structure API: Replace has_block with __contains__

This commit is contained in:
Nimisha Asthagiri
2016-02-22 11:24:16 -05:00
parent d969f48646
commit 70469c16b2
6 changed files with 12 additions and 11 deletions

View File

@@ -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,

View File

@@ -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