refactor: rename module -> block within lms/djangoapps/courseware
Also, removed unused `_has_access_xmodule` methid from `lms/djangoapps/courseware/access.py`.
This commit is contained in:
@@ -121,8 +121,8 @@ def get_test_system(
|
||||
|
||||
id_manager = CourseLocationManager(course_id)
|
||||
|
||||
def get_module(descriptor):
|
||||
"""Mocks module_system get_module function"""
|
||||
def get_block(descriptor):
|
||||
"""Mocks module_system get_block function"""
|
||||
|
||||
# Unlike XBlock Runtimes or DescriptorSystems,
|
||||
# each XModule is provided with a new ModuleSystem.
|
||||
@@ -138,7 +138,7 @@ def get_test_system(
|
||||
return descriptor
|
||||
|
||||
return TestModuleSystem(
|
||||
get_module=get_module,
|
||||
get_block=get_block,
|
||||
services={
|
||||
'user': user_service,
|
||||
'mako': mako_service,
|
||||
|
||||
@@ -130,9 +130,9 @@ class ConditionalFactory:
|
||||
ScopeIds(None, None, cond_location, cond_location)
|
||||
)
|
||||
cond_descriptor.xmodule_runtime = system
|
||||
system.get_module = lambda desc: desc if visible_to_nonstaff_users(desc) else None
|
||||
system.get_block_for_descriptor = lambda desc: desc if visible_to_nonstaff_users(desc) else None
|
||||
cond_descriptor.get_required_blocks = [
|
||||
system.get_module(source_descriptor),
|
||||
system.get_block_for_descriptor(source_descriptor),
|
||||
]
|
||||
|
||||
# return dict:
|
||||
@@ -228,7 +228,7 @@ class ConditionalBlockXmlTest(unittest.TestCase):
|
||||
|
||||
def get_module_for_location(self, location):
|
||||
descriptor = self.modulestore.get_item(location, depth=None)
|
||||
return self.test_system.get_module(descriptor)
|
||||
return self.test_system.get_block_for_descriptor(descriptor)
|
||||
|
||||
@patch('xmodule.x_module.descriptor_global_local_resource_url')
|
||||
@patch.dict(settings.FEATURES, {'ENABLE_EDXNOTES': False})
|
||||
|
||||
@@ -62,15 +62,15 @@ class LibraryContentTest(MixedSplitTestCase):
|
||||
module_system.descriptor_runtime = module.runtime._descriptor_system # pylint: disable=protected-access
|
||||
module_system._services['library_tools'] = self.tools # pylint: disable=protected-access
|
||||
|
||||
def get_module(descriptor):
|
||||
"""Mocks module_system get_module function"""
|
||||
def get_block(descriptor):
|
||||
"""Mocks module_system get_block function"""
|
||||
sub_module_system = get_test_system(course_id=module.location.course_key)
|
||||
sub_module_system.get_module = get_module
|
||||
sub_module_system.get_block_for_descriptor = get_block
|
||||
sub_module_system.descriptor_runtime = descriptor._runtime # pylint: disable=protected-access
|
||||
descriptor.bind_for_student(sub_module_system, self.user_id)
|
||||
return descriptor
|
||||
|
||||
module_system.get_module = get_module
|
||||
module_system.get_block_for_descriptor = get_block
|
||||
module.xmodule_runtime = module_system
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user