""" Common test utilities for courseware functionality """ from abc import ABCMeta, abstractmethod from datetime import datetime, timedelta from unittest.mock import patch from urllib.parse import urlencode import ddt from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from lms.djangoapps.courseware.tests.helpers import set_preview_mode from lms.djangoapps.courseware.utils import is_mode_upsellable from openedx.features.course_experience.url_helpers import get_courseware_url from common.djangoapps.student.tests.factories import AdminFactory, CourseEnrollmentFactory, UserFactory from common.djangoapps.course_modes.models import CourseMode from common.djangoapps.course_modes.tests.factories import CourseModeFactory from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory, check_mongo_calls # lint-amnesty, pylint: disable=wrong-import-order from .field_overrides import OverrideModulestoreFieldData from .tests.helpers import MasqueradeMixin @ddt.ddt class RenderXBlockTestMixin(MasqueradeMixin, metaclass=ABCMeta): """ Mixin for testing the courseware.render_xblock function. It can be used for testing any higher-level endpoint that calls this method. """ # DOM elements that appear in the LMS Courseware, # but are excluded from the xBlock-only rendering. COURSEWARE_CHROME_HTML_ELEMENTS = [ '