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:
0x29a
2022-12-23 15:27:31 +01:00
committed by Agrendalath
parent 611563600c
commit 9d8375ff99
55 changed files with 432 additions and 443 deletions

View File

@@ -27,7 +27,7 @@ from common.djangoapps.student.tests.factories import InstructorFactory
from common.djangoapps.student.tests.factories import OrgInstructorFactory
from common.djangoapps.student.tests.factories import OrgStaffFactory
from common.djangoapps.student.tests.factories import StaffFactory
from lms.djangoapps.courseware.module_render import load_single_xblock
from lms.djangoapps.courseware.block_render import load_single_xblock
from lms.djangoapps.courseware.tests.helpers import MasqueradeMixin
from lms.djangoapps.discussion.django_comment_client.tests.factories import RoleFactory
from openedx.core.djangoapps.django_comment_common.models import (

View File

@@ -5,7 +5,7 @@ Utilities for course updates.
import hashlib
from datetime import datetime
from lms.djangoapps.courseware.courses import get_course_info_section_module
from lms.djangoapps.courseware.courses import get_course_info_section_block
from openedx.core.djangoapps.user_api.course_tag.api import get_course_tag, set_course_tag
STATUS_VISIBLE = 'visible'
@@ -59,7 +59,7 @@ def get_ordered_updates(request, course):
"""
Returns all public course updates in reverse chronological order, including dismissed ones.
"""
info_module = get_course_info_section_module(request, request.user, course, 'updates')
info_module = get_course_info_section_block(request, request.user, course, 'updates')
if not info_module:
return []

View File

@@ -10,7 +10,7 @@ from django.views.decorators.cache import cache_control
from opaque_keys.edx.keys import CourseKey
from web_fragments.fragment import Fragment
from lms.djangoapps.courseware.courses import get_course_info_section_module, get_course_with_access
from lms.djangoapps.courseware.courses import get_course_info_section_block, get_course_with_access
from lms.djangoapps.courseware.views.views import CourseTabView
from openedx.core.djangoapps.plugin_api.views import EdxFragmentView
from openedx.features.course_experience import default_course_url
@@ -76,7 +76,7 @@ class CourseUpdatesFragmentView(EdxFragmentView):
for older implementations and a few tests that store
a single html object representing all the updates.
"""
info_module = get_course_info_section_module(request, request.user, course, 'updates')
info_module = get_course_info_section_block(request, request.user, course, 'updates')
info_block = getattr(info_module, '_xmodule', info_module)
return info_block.system.service(
info_block, "replace_urls"

View File

@@ -8,7 +8,7 @@ from edx_toggles.toggles.testutils import override_waffle_flag
from lms.djangoapps.ccx.tests.test_overrides import inject_field_overrides
from lms.djangoapps.courseware.model_data import FieldDataCache
from lms.djangoapps.courseware.module_render import get_module
from lms.djangoapps.courseware.block_render import get_block
from openedx.features.course_experience import RELATIVE_DATES_FLAG
from xmodule.capa_block import SHOWANSWER # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
@@ -33,7 +33,7 @@ class ShowAnswerFieldOverrideTest(ModuleStoreTestCase):
def get_course_block(self, course):
request = RequestFactory().request()
field_data_cache = FieldDataCache([], course.id, self.user)
return get_module(self.user, request, course.location, field_data_cache, course=course)
return get_block(self.user, request, course.location, field_data_cache, course=course)
@ddt.data(True, False)
def test_override_enabled_for(self, active):