def setUp(self): super(XBlockSupportTestCase, self).setUp() # Set up XBlockConfigurations for disabled and deprecated states block_config = [ ("poll", True, True), ("survey", False, True), ("done", True, False), ] for name, enabled, deprecated in block_config: XBlockConfiguration(name=name, enabled=enabled, deprecated=deprecated).save() # Set up XBlockStudioConfigurations for studio support level studio_block_config = [ ("poll", "", False, XBlockStudioConfiguration.FULL_SUPPORT), # FULL_SUPPORT negated by enabled=False ("survey", "", True, XBlockStudioConfiguration.UNSUPPORTED), ("done", "", True, XBlockStudioConfiguration.FULL_SUPPORT), ("problem", "", True, XBlockStudioConfiguration.FULL_SUPPORT), ("problem", "multiple_choice", True, XBlockStudioConfiguration.FULL_SUPPORT), ("problem", "circuit_schematic_builder", True, XBlockStudioConfiguration.UNSUPPORTED), ("problem", "ora1", False, XBlockStudioConfiguration.FULL_SUPPORT), ("html", "zoom", True, XBlockStudioConfiguration.PROVISIONAL_SUPPORT), ("split_module", "", True, XBlockStudioConfiguration.UNSUPPORTED), ] for name, template, enabled, support_level in studio_block_config: XBlockStudioConfiguration(name=name, template=template, enabled=enabled, support_level=support_level).save()
def test_disabled_blocks(self): """ Tests the disabled_xblocks method """ disabled_xblock_names = [block.name for block in disabled_xblocks()] self.assertItemsEqual(["survey"], disabled_xblock_names) XBlockConfiguration(name="poll", enabled=False, deprecated=True).save() disabled_xblock_names = [block.name for block in disabled_xblocks()] self.assertItemsEqual(["survey", "poll"], disabled_xblock_names)
def test_deprecated_blocks(self): """ Tests the deprecated_xblocks method """ deprecated_xblock_names = [ block.name for block in deprecated_xblocks() ] six.assertCountEqual(self, ["poll", "survey"], deprecated_xblock_names) XBlockConfiguration(name="poll", enabled=True, deprecated=False).save() deprecated_xblock_names = [ block.name for block in deprecated_xblocks() ] six.assertCountEqual(self, ["survey"], deprecated_xblock_names)