""" 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 openedx.features.course_experience.url_helpers import get_legacy_courseware_url from common.djangoapps.student.tests.factories import AdminFactory, CourseEnrollmentFactory, UserFactory from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls 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 = [ '