Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lms/djangoapps/course_home_api/outline/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def test_vertical_icon(self, block_categories, expected_icon):

assert vertical_data['icon'] == expected_icon

@patch('xmodule.html_block.HtmlBlock.icon_class', 'video')
@patch('xmodule.html_block.HtmlBlock.icon_class', 'video', create=True)
def test_vertical_icon_determined_by_icon_class(self):
"""Test that the API checks the children `icon_class` to determine the icon for the unit."""
self.add_blocks_to_course()
Expand Down
6 changes: 3 additions & 3 deletions lms/djangoapps/courseware/tests/test_block_render.py
Original file line number Diff line number Diff line change
@@ -1,117 +1,117 @@
"""
Test for lms courseware app, block render unit
"""
import json
import textwrap
import warnings
from datetime import datetime
from functools import partial
from unittest.mock import MagicMock, Mock, patch

import ddt
import pytest
import pytz
from bson import ObjectId
from completion.models import BlockCompletion # lint-amnesty, pylint: disable=wrong-import-order
from completion.waffle import ENABLE_COMPLETION_TRACKING_SWITCH # lint-amnesty, pylint: disable=wrong-import-order
from django.conf import settings # lint-amnesty, pylint: disable=wrong-import-order
from django.contrib.auth.models import AnonymousUser # lint-amnesty, pylint: disable=wrong-import-order
from django.http import Http404, HttpResponse # lint-amnesty, pylint: disable=wrong-import-order
from django.middleware.csrf import get_token # lint-amnesty, pylint: disable=wrong-import-order
from django.test.client import RequestFactory # lint-amnesty, pylint: disable=wrong-import-order
from django.test.utils import override_settings # lint-amnesty, pylint: disable=wrong-import-order
from django.urls import reverse # lint-amnesty, pylint: disable=wrong-import-order
from edx_proctoring.api import ( # lint-amnesty, pylint: disable=wrong-import-order
create_exam,
create_exam_attempt,
update_attempt_status,
)
from edx_proctoring.runtime import set_runtime_service # lint-amnesty, pylint: disable=wrong-import-order
from edx_proctoring.tests.test_services import ( # lint-amnesty, pylint: disable=wrong-import-order
MockCertificateService,
MockCreditService,
MockGradesService,
)
from edx_toggles.toggles.testutils import override_waffle_switch # lint-amnesty, pylint: disable=wrong-import-order
from edx_when.field_data import DateLookupFieldData # lint-amnesty, pylint: disable=wrong-import-order
from freezegun import freeze_time # lint-amnesty, pylint: disable=wrong-import-order
from milestones.tests.utils import MilestonesTestCaseMixin # lint-amnesty, pylint: disable=wrong-import-order
from opaque_keys.edx.asides import AsideUsageKeyV2 # lint-amnesty, pylint: disable=wrong-import-order
from opaque_keys.edx.keys import CourseKey, UsageKey # lint-amnesty, pylint: disable=wrong-import-order
from pyquery import PyQuery # lint-amnesty, pylint: disable=wrong-import-order
from web_fragments.fragment import Fragment # lint-amnesty, pylint: disable=wrong-import-order
from xblock.completable import CompletableXBlockMixin # lint-amnesty, pylint: disable=wrong-import-order
from xblock.core import XBlock, XBlockAside # lint-amnesty, pylint: disable=wrong-import-order
from xblock.exceptions import NoSuchServiceError
from xblock.field_data import FieldData # lint-amnesty, pylint: disable=wrong-import-order
from xblock.fields import ScopeIds # lint-amnesty, pylint: disable=wrong-import-order
from xblock.runtime import DictKeyValueStore, KvsFieldData # lint-amnesty, pylint: disable=wrong-import-order
from xblock.test.tools import TestRuntime # lint-amnesty, pylint: disable=wrong-import-order
from xblocks_contrib.problem.capa.tests.response_xml_factory import (
OptionResponseXMLFactory, # lint-amnesty, pylint: disable=reimported
)

from common.djangoapps.course_modes.models import CourseMode # lint-amnesty, pylint: disable=reimported
from common.djangoapps.student.models import CourseEnrollment, anonymous_id_for_user
from common.djangoapps.student.tests.factories import (
BetaTesterFactory,
GlobalStaffFactory,
InstructorFactory,
RequestFactoryNoCsrf,
StaffFactory,
UserFactory,
)
from common.djangoapps.xblock_django.constants import (
ATTR_KEY_ANONYMOUS_USER_ID,
ATTR_KEY_DEPRECATED_ANONYMOUS_USER_ID,
ATTR_KEY_USER_IS_BETA_TESTER,
ATTR_KEY_USER_IS_GLOBAL_STAFF,
ATTR_KEY_USER_IS_STAFF,
ATTR_KEY_USER_ROLE,
)
from common.djangoapps.xblock_django.models import XBlockConfiguration
from lms.djangoapps.courseware import block_render as render
from lms.djangoapps.courseware.access_response import AccessResponse
from lms.djangoapps.courseware.block_render import get_block_for_descriptor, hash_resource
from lms.djangoapps.courseware.courses import get_course_info_section, get_course_with_access
from lms.djangoapps.courseware.field_overrides import OverrideFieldData
from lms.djangoapps.courseware.masquerade import CourseMasquerade
from lms.djangoapps.courseware.model_data import FieldDataCache
from lms.djangoapps.courseware.models import StudentModule
from lms.djangoapps.courseware.tests.factories import StudentModuleFactory
from lms.djangoapps.courseware.tests.test_submitting_problems import TestSubmittingProblems
from lms.djangoapps.courseware.tests.tests import LoginEnrollmentTestCase
from lms.djangoapps.lms_xblock.field_data import LmsFieldData
from lms.djangoapps.verify_student.tests.factories import SoftwareSecurePhotoVerificationFactory
from openedx.core.djangoapps.credit.api import set_credit_requirement_status, set_credit_requirements
from openedx.core.djangoapps.credit.models import CreditCourse
from openedx.core.djangoapps.oauth_dispatch.jwt import _create_jwt, create_jwt_for_user
from openedx.core.djangoapps.oauth_dispatch.tests.factories import AccessTokenFactory, ApplicationFactory
from openedx.core.lib.courses import course_image_url
from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.url_utils import quote_slashes
from xmodule.capa_block import ProblemBlock
from xmodule.contentstore.django import contentstore
from xmodule.html_block import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock
from xmodule.lti_block import LTIBlock
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import XBlockI18nService, modulestore
from xmodule.modulestore.tests.django_utils import (
TEST_DATA_SPLIT_MODULESTORE,
ModuleStoreTestCase,
SharedModuleStoreTestCase,
upload_file_to_course,
)
from xmodule.modulestore.tests.factories import ( # lint-amnesty, pylint: disable=wrong-import-order
BlockFactory,
CourseFactory,
ToyCourseFactory,
check_mongo_calls,
)
from xmodule.modulestore.tests.test_asides import AsideTestType # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.services import RebindUserServiceError
from xmodule.video_block import VideoBlock # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.x_module import STUDENT_VIEW, ModuleStoreRuntime # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.x_module import STUDENT_VIEW, ModuleStoreRuntime, XModuleMixin # lint-amnesty, pylint: disable=wrong-import-order

Check failure on line 114 in lms/djangoapps/courseware/tests/test_block_render.py

View workflow job for this annotation

GitHub Actions / Quality Others (ubuntu-24.04, 3.12, 20)

ruff (I001)

lms/djangoapps/courseware/tests/test_block_render.py:4:1: I001 Import block is un-sorted or un-formatted help: Organize imports

TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT

Expand Down Expand Up @@ -1951,8 +1951,8 @@
days_early_for_beta=None,
)
block.runtime = ModuleStoreRuntime(None, None, None)
# Use the xblock_class's bind_for_student method
block.bind_for_student = partial(xblock_class.bind_for_student, block)
# Use XModuleMixin.bind_for_student since it's no longer defined on the block classes directly
block.bind_for_student = partial(XModuleMixin.bind_for_student, block)

if hasattr(xblock_class, 'module_class'):
block.module_class = xblock_class.module_class
Expand Down
1 change: 1 addition & 0 deletions lms/djangoapps/courseware/tests/test_discussion_xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def setUp(self):
})
scope_ids = mock.Mock()
scope_ids.usage_id.course_key = self.course_id
scope_ids.usage_id.context_key = self.course_id
self.block = DiscussionXBlock(
self.runtime,
field_data=self.data,
Expand Down
4 changes: 2 additions & 2 deletions openedx/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ def add_optional_apps(optional_apps, installed_apps):
# .. toggle_warning: Not production-ready until relevant subtask https://github.com/openedx/edx-platform/issues/34827 is done.
# .. toggle_creation_date: 2024-11-10
# .. toggle_target_removal_date: 2026-04-10
USE_EXTRACTED_DISCUSSION_BLOCK = False
USE_EXTRACTED_DISCUSSION_BLOCK = True

# .. toggle_name: USE_EXTRACTED_PROBLEM_BLOCK
# .. toggle_default: False
Expand All @@ -2097,7 +2097,7 @@ def add_optional_apps(optional_apps, installed_apps):
# .. toggle_warning: Not production-ready until relevant subtask https://github.com/openedx/edx-platform/issues/34827 is done.
# .. toggle_creation_date: 2024-11-10
# .. toggle_target_removal_date: 2026-04-10
USE_EXTRACTED_PROBLEM_BLOCK = False
USE_EXTRACTED_PROBLEM_BLOCK = True

# .. toggle_name: USE_EXTRACTED_VIDEO_BLOCK
# .. toggle_default: True
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ xblock-utils==4.0.0
# via
# edx-sga
# xblock-poll
xblocks-contrib==0.15.3
git+https://github.com/openedx/xblocks-contrib.git@remove-legacy-mixins#egg=xblocks-contrib
# via -r requirements/edx/bundled.in
xmlsec==1.3.14
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2327,7 +2327,7 @@ xblock-utils==4.0.0
# -r requirements/edx/testing.txt
# edx-sga
# xblock-poll
xblocks-contrib==0.15.3
git+https://github.com/openedx/xblocks-contrib.git@remove-legacy-mixins#egg=xblocks-contrib
# via
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ xblock-utils==4.0.0
# -r requirements/edx/base.txt
# edx-sga
# xblock-poll
xblocks-contrib==0.15.3
git+https://github.com/openedx/xblocks-contrib.git@remove-legacy-mixins#egg=xblocks-contrib
# via -r requirements/edx/base.txt
xmlsec==1.3.14
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ xblock-utils==4.0.0
# -r requirements/edx/base.txt
# edx-sga
# xblock-poll
xblocks-contrib==0.15.3
git+https://github.com/openedx/xblocks-contrib.git@remove-legacy-mixins#egg=xblocks-contrib
# via -r requirements/edx/base.txt
xmlsec==1.3.14
# via
Expand Down
4 changes: 3 additions & 1 deletion xmodule/modulestore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from operator import itemgetter
from zoneinfo import ZoneInfo

from django.conf import settings
from django.db import transaction
from opaque_keys.edx.keys import AssetKey, CourseKey
from opaque_keys.edx.locations import Location # For import backwards compatibility
Expand Down Expand Up @@ -1196,7 +1197,8 @@ def __init__( # lint-amnesty, pylint: disable=unused-argument
# TODO move the inheritance_cache_subsystem to classes which use it
self.metadata_inheritance_cache_subsystem = metadata_inheritance_cache_subsystem
self.request_cache = request_cache
self.xblock_mixins = xblock_mixins
settings_mixins = getattr(settings, 'XBLOCK_MIXINS', ())
self.xblock_mixins = tuple(dict.fromkeys(settings_mixins + xblock_mixins))
self.xblock_select = xblock_select
self.xblock_field_data_wrappers = xblock_field_data_wrappers
self.disabled_xblock_types = disabled_xblock_types
Expand Down
Loading