From 7f2e68c2fdf0830393a5418b9ac964823098af99 Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:15:27 +0200 Subject: [PATCH 01/25] refactor: xmodule/annotatable_module.py -> xmodule/annotatable_block.py --- setup.py | 2 +- xmodule/{annotatable_module.py => annotatable_block.py} | 0 xmodule/static_content.py | 2 +- .../{test_annotatable_module.py => test_annotatable_block.py} | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename xmodule/{annotatable_module.py => annotatable_block.py} (100%) rename xmodule/tests/{test_annotatable_module.py => test_annotatable_block.py} (99%) diff --git a/setup.py b/setup.py index aead87f33ed4..af82d6246be6 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ XBLOCKS = [ "about = xmodule.html_module:AboutBlock", "book = xmodule.template_module:TranslateCustomTagBlock", - "annotatable = xmodule.annotatable_module:AnnotatableBlock", + "annotatable = xmodule.annotatable_block:AnnotatableBlock", "chapter = xmodule.seq_module:SectionBlock", "conditional = xmodule.conditional_module:ConditionalBlock", "course = xmodule.course_module:CourseBlock", diff --git a/xmodule/annotatable_module.py b/xmodule/annotatable_block.py similarity index 100% rename from xmodule/annotatable_module.py rename to xmodule/annotatable_block.py diff --git a/xmodule/static_content.py b/xmodule/static_content.py index c2880edb5420..b2f28411bdb9 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -19,7 +19,7 @@ from docopt import docopt from path import Path as path -from xmodule.annotatable_module import AnnotatableBlock +from xmodule.annotatable_block import AnnotatableBlock from xmodule.capa_module import ProblemBlock from xmodule.conditional_module import ConditionalBlock from xmodule.html_module import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock diff --git a/xmodule/tests/test_annotatable_module.py b/xmodule/tests/test_annotatable_block.py similarity index 99% rename from xmodule/tests/test_annotatable_module.py rename to xmodule/tests/test_annotatable_block.py index 5cdbac7b6265..b83be2248e6e 100644 --- a/xmodule/tests/test_annotatable_module.py +++ b/xmodule/tests/test_annotatable_block.py @@ -8,7 +8,7 @@ from xblock.field_data import DictFieldData from xblock.fields import ScopeIds -from xmodule.annotatable_module import AnnotatableBlock +from xmodule.annotatable_block import AnnotatableBlock from . import get_test_system From 4c005e86e8ab6b8fbada56549214effe6d86118a Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:01:20 +0200 Subject: [PATCH 02/25] refactor: xmodule/capa_module.py -> xmodule/capa_block.py --- .../contentstore/tests/test_contentstore.py | 4 +- .../contentstore/tests/test_crud.py | 2 +- .../contentstore/views/tests/test_item.py | 2 +- cms/lib/xblock/tagging/tagging.py | 2 +- common/static/js/capa/README | 2 +- .../0015-sub-project-dissolution.rst | 2 +- .../courseware/tests/test_module_render.py | 2 +- .../tests/test_tasks_helper.py | 8 ++-- .../show_answer/show_answer_field_override.py | 2 +- .../tests/test_show_answer_override.py | 2 +- setup.py | 2 +- xmodule/capa/capa_problem.py | 28 ++++++------ xmodule/capa/responsetypes.py | 18 ++++---- xmodule/capa/tests/helpers.py | 16 +++---- xmodule/capa/tests/response_xml_factory.py | 2 +- xmodule/capa/tests/test_hint_functionality.py | 44 +++++++++---------- xmodule/capa/util.py | 12 ++--- xmodule/{capa_module.py => capa_block.py} | 14 +++--- xmodule/library_tools.py | 2 +- xmodule/modulestore/split_mongo/split.py | 6 +-- .../tests/test_split_copy_from_template.py | 2 +- xmodule/static_content.py | 2 +- ...test_capa_module.py => test_capa_block.py} | 34 +++++++------- xmodule/tests/test_delay_between_attempts.py | 8 ++-- xmodule/tests/test_library_content.py | 2 +- 25 files changed, 110 insertions(+), 110 deletions(-) rename xmodule/{capa_module.py => capa_block.py} (99%) rename xmodule/tests/{test_capa_module.py => test_capa_block.py} (99%) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 847c18ed3366..5049a91e65cd 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -24,7 +24,7 @@ from opaque_keys.edx.keys import AssetKey, CourseKey, UsageKey from opaque_keys.edx.locations import CourseLocator from path import Path as path -from xmodule.capa_module import ProblemBlock +from xmodule.capa_block import ProblemBlock from xmodule.contentstore.content import StaticContent from xmodule.contentstore.django import contentstore from xmodule.contentstore.utils import empty_asset_trashcan, restore_asset_from_trashcan @@ -1518,7 +1518,7 @@ def test_create_item(self): retarget = str(course.id.make_usage_key('chapter', 'REPLACE')).replace('REPLACE', r'([0-9]|[a-f]){3,}') self.assertRegex(data['locator'], retarget) - def test_capa_module(self): + def test_capa_block(self): """Test that a problem treats markdown specially.""" course = CourseFactory.create() diff --git a/cms/djangoapps/contentstore/tests/test_crud.py b/cms/djangoapps/contentstore/tests/test_crud.py index 2507dbb61b0b..f1be99b41acb 100644 --- a/cms/djangoapps/contentstore/tests/test_crud.py +++ b/cms/djangoapps/contentstore/tests/test_crud.py @@ -2,7 +2,7 @@ from xmodule import templates -from xmodule.capa_module import ProblemBlock +from xmodule.capa_block import ProblemBlock from xmodule.course_module import CourseBlock from xmodule.html_module import HtmlBlock from xmodule.modulestore import ModuleStoreEnum diff --git a/cms/djangoapps/contentstore/views/tests/test_item.py b/cms/djangoapps/contentstore/views/tests/test_item.py index 668aee5ab096..6a643de54f20 100644 --- a/cms/djangoapps/contentstore/views/tests/test_item.py +++ b/cms/djangoapps/contentstore/views/tests/test_item.py @@ -27,7 +27,7 @@ from xblock.runtime import DictKeyValueStore, KvsFieldData from xblock.test.tools import TestRuntime from xblock.validation import ValidationMessage -from xmodule.capa_module import ProblemBlock +from xmodule.capa_block import ProblemBlock from xmodule.course_module import DEFAULT_START_DATE from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore diff --git a/cms/lib/xblock/tagging/tagging.py b/cms/lib/xblock/tagging/tagging.py index 8e287589c9a6..80f7cc0f2859 100644 --- a/cms/lib/xblock/tagging/tagging.py +++ b/cms/lib/xblock/tagging/tagging.py @@ -8,7 +8,7 @@ from xblock.fields import Dict, Scope from common.djangoapps.edxmako.shortcuts import render_to_string -from xmodule.capa_module import ProblemBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.capa_block import ProblemBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.x_module import AUTHOR_VIEW # lint-amnesty, pylint: disable=wrong-import-order _ = lambda text: text diff --git a/common/static/js/capa/README b/common/static/js/capa/README index bb698ef00e18..ca845717fe53 100644 --- a/common/static/js/capa/README +++ b/common/static/js/capa/README @@ -1 +1 @@ -These files really should be in the capa module, but we don't have a way to load js from there at the moment. (TODO) +These files really should be in the capa block, but we don't have a way to load js from there at the moment. (TODO) diff --git a/docs/decisions/0015-sub-project-dissolution.rst b/docs/decisions/0015-sub-project-dissolution.rst index e179caeabcb7..a6cf3fbe0586 100644 --- a/docs/decisions/0015-sub-project-dissolution.rst +++ b/docs/decisions/0015-sub-project-dissolution.rst @@ -131,7 +131,7 @@ capa * PR: https://github.com/openedx/edx-platform/pull/30403 -* Notes: Like xmodule, extracting capa from edx-platform would have been difficult. However, updating its import path was feasible; so, to create avoid creating a sixth top-level package, it was decided to move the code within ./xmodule as a sub-packages. ./xmodule was chosen as the parent package because it contains related code, notably ./xmodule/capa_module.py, which defines the ``ProblemBlock`` (formerly the ``CapaModule``). +* Notes: Like xmodule, extracting capa from edx-platform would have been difficult. However, updating its import path was feasible; so, to create avoid creating a sixth top-level package, it was decided to move the code within ./xmodule as a sub-packages. ./xmodule was chosen as the parent package because it contains related code, notably ./xmodule/capa_block.py, which defines the ``ProblemBlock`` (formerly the ``CapaModule``). xblock_discussion ----------------- diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index a5eafc483c93..a338a5e74a0f 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -42,7 +42,7 @@ from xmodule.capa.tests.response_xml_factory import OptionResponseXMLFactory # lint-amnesty, pylint: disable=reimported from xmodule.capa.xqueue_interface import XQueueInterface -from xmodule.capa_module import ProblemBlock +from xmodule.capa_block import ProblemBlock from xmodule.contentstore.django import contentstore from xmodule.html_module import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock from xmodule.lti_module import LTIBlock diff --git a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py index 58d0cbb4e802..d632135c7e74 100644 --- a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py +++ b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py @@ -477,7 +477,7 @@ def _remove_capa_report_generator(self): Temporarily removes the generate_report_data method so we can test report generation when it's absent. """ - from xmodule.capa_module import ProblemBlock + from xmodule.capa_block import ProblemBlock generate_report_data = ProblemBlock.generate_report_data del ProblemBlock.generate_report_data try: @@ -532,7 +532,7 @@ def test_build_student_data_for_block_without_generate_report_data(self, mock_li assert student_data_keys_list == ['username', 'title', 'location', 'block_key', 'state'] mock_list_problem_responses.assert_called_with(self.course.id, ANY, ANY) - @patch('xmodule.capa_module.ProblemBlock.generate_report_data', create=True) + @patch('xmodule.capa_block.ProblemBlock.generate_report_data', create=True) def test_build_student_data_for_block_with_mock_generate_report_data(self, mock_generate_report_data): """ Ensure that building student data for a block that supports the @@ -571,7 +571,7 @@ def test_build_student_data_for_block_with_mock_generate_report_data(self, mock_ assert student_data[0]['state'] == student_data[1]['state'] assert student_data_keys_list == ['username', 'title', 'location', 'more', 'some', 'block_key', 'state'] - @patch('xmodule.capa_module.ProblemBlock.generate_report_data', create=True) + @patch('xmodule.capa_block.ProblemBlock.generate_report_data', create=True) def test_build_student_data_for_block_with_ordered_generate_report_data(self, mock_generate_report_data): """ Ensure that building student data for a block that returns OrderedDicts from the @@ -698,7 +698,7 @@ def test_build_student_data_with_filter(self, filters, filtered_count): assert len(student_data) == filtered_count @patch('lms.djangoapps.instructor_task.tasks_helper.grades.list_problem_responses') - @patch('xmodule.capa_module.ProblemBlock.generate_report_data', create=True) + @patch('xmodule.capa_block.ProblemBlock.generate_report_data', create=True) def test_build_student_data_for_block_with_generate_report_data_not_implemented( self, mock_generate_report_data, diff --git a/openedx/features/personalized_learner_schedules/show_answer/show_answer_field_override.py b/openedx/features/personalized_learner_schedules/show_answer/show_answer_field_override.py index 31ac000df5a0..d6452a84962f 100644 --- a/openedx/features/personalized_learner_schedules/show_answer/show_answer_field_override.py +++ b/openedx/features/personalized_learner_schedules/show_answer/show_answer_field_override.py @@ -5,7 +5,7 @@ from lms.djangoapps.courseware.field_overrides import FieldOverrideProvider from openedx.features.course_experience import RELATIVE_DATES_FLAG -from xmodule.capa_module import SHOWANSWER # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.capa_block import SHOWANSWER # lint-amnesty, pylint: disable=wrong-import-order class ShowAnswerFieldOverride(FieldOverrideProvider): diff --git a/openedx/features/personalized_learner_schedules/show_answer/tests/test_show_answer_override.py b/openedx/features/personalized_learner_schedules/show_answer/tests/test_show_answer_override.py index 339069a74546..1ac8085fea41 100644 --- a/openedx/features/personalized_learner_schedules/show_answer/tests/test_show_answer_override.py +++ b/openedx/features/personalized_learner_schedules/show_answer/tests/test_show_answer_override.py @@ -10,7 +10,7 @@ from lms.djangoapps.courseware.model_data import FieldDataCache from lms.djangoapps.courseware.module_render import get_module from openedx.features.course_experience import RELATIVE_DATES_FLAG -from xmodule.capa_module import SHOWANSWER # lint-amnesty, pylint: disable=wrong-import-order +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 from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order diff --git a/setup.py b/setup.py index af82d6246be6..a614cfd90334 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ "library_sourced = xmodule.library_sourced_block:LibrarySourcedBlock", "lti = xmodule.lti_module:LTIBlock", "poll_question = xmodule.poll_module:PollBlock", - "problem = xmodule.capa_module:ProblemBlock", + "problem = xmodule.capa_block:ProblemBlock", "randomize = xmodule.randomize_module:RandomizeBlock", "sequential = xmodule.seq_module:SequenceBlock", "slides = xmodule.template_module:TranslateCustomTagBlock", diff --git a/xmodule/capa/capa_problem.py b/xmodule/capa/capa_problem.py index b10b4d6a7dd0..7a6592e0958c 100644 --- a/xmodule/capa/capa_problem.py +++ b/xmodule/capa/capa_problem.py @@ -10,7 +10,7 @@ """ Main module which shows problems (of "capa" type). -This is used by capa_module. +This is used by capa_block. """ @@ -34,7 +34,7 @@ import xmodule.capa.xqueue_interface as xqueue_interface from xmodule.capa.correctmap import CorrectMap from xmodule.capa.safe_exec import safe_exec -from xmodule.capa.util import contextualize_text, convert_files_to_filenames, get_course_id_from_capa_module +from xmodule.capa.util import contextualize_text, convert_files_to_filenames, get_course_id_from_capa_block from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib.edx_six import get_gettext from xmodule.stringify import stringify_children @@ -130,7 +130,7 @@ class LoncapaProblem(object): """ Main class for capa Problems. """ - def __init__(self, problem_text, id, capa_system, capa_module, # pylint: disable=redefined-builtin + def __init__(self, problem_text, id, capa_system, capa_block, # pylint: disable=redefined-builtin state=None, seed=None, minimal_init=False, extract_tree=True): """ Initializes capa Problem. @@ -141,7 +141,7 @@ def __init__(self, problem_text, id, capa_system, capa_module, # pylint: disabl id (string): identifier for this problem, often a filename (no spaces). capa_system (LoncapaSystem): LoncapaSystem instance which provides OS, rendering, user context, and other resources. - capa_module: instance needed to access runtime/logging + capa_block: instance needed to access runtime/logging state (dict): containing the following keys: - `seed` (int) random number generator seed - `student_answers` (dict) maps input id to the stored answer for that input @@ -159,7 +159,7 @@ def __init__(self, problem_text, id, capa_system, capa_module, # pylint: disabl self.do_reset() self.problem_id = id self.capa_system = capa_system - self.capa_module = capa_module + self.capa_block = capa_block state = state or {} @@ -190,12 +190,12 @@ def __init__(self, problem_text, id, capa_system, capa_module, # pylint: disabl try: self.make_xml_compatible(self.tree) except Exception: - capa_module = self.capa_module + capa_block = self.capa_block log.exception( "CAPAProblemError: %s, id:%s, data: %s", - capa_module.display_name, + capa_block.display_name, self.problem_id, - capa_module.data + capa_block.data ) raise @@ -421,7 +421,7 @@ def get_recentmost_queuetime(self): def grade_answers(self, answers): """ - Grade student responses. Called by capa_module.submit_problem. + Grade student responses. Called by capa_block.submit_problem. `answers` is a dict of all the entries from request.POST, but with the first part of each key removed (the string before the first "_"). @@ -501,7 +501,7 @@ def get_question_answers(self): Returns a dict of answer_ids to answer values. If we cannot generate an answer (this sometimes happens in customresponses), that answer_id is not included. Called by "show answers" button JSON request - (see capa_module) + (see capa_block) """ # dict of (id, correct_answer) answer_map = {} @@ -935,8 +935,8 @@ def _extract_context(self, tree): python_path=python_path, extra_files=extra_files, cache=self.capa_system.cache, - limit_overrides_context=get_course_id_from_capa_module( - self.capa_module + limit_overrides_context=get_course_id_from_capa_block( + self.capa_block ), slug=self.problem_id, unsafely=self.capa_system.can_execute_unsafe_code(), @@ -994,7 +994,7 @@ def _extract_html(self, problemtree): # private # If we're withholding correctness, don't show adaptive hints either. # Note that regular, "demand" hints will be shown, if the course author has added them to the problem. - if not self.capa_module.correctness_available(): + if not self.capa_block.correctness_available(): status = 'submitted' else: # If the the problem has not been saved since the last submit set the status to the @@ -1107,7 +1107,7 @@ def _preprocess_problem(self, tree, minimal_init): # private # instantiate capa Response responsetype_cls = responsetypes.registry.get_class_for_tag(response.tag) responder = responsetype_cls( - response, inputfields, self.context, self.capa_system, self.capa_module, minimal_init + response, inputfields, self.context, self.capa_system, self.capa_block, minimal_init ) # save in list in self self.responders[response] = responder diff --git a/xmodule/capa/responsetypes.py b/xmodule/capa/responsetypes.py index 03b502ee76d9..035de574b440 100644 --- a/xmodule/capa/responsetypes.py +++ b/xmodule/capa/responsetypes.py @@ -57,7 +57,7 @@ convert_files_to_filenames, default_tolerance, find_with_default, - get_course_id_from_capa_module, + get_course_id_from_capa_block, get_inner_html_from_xpath, is_list_of_files ) @@ -162,7 +162,7 @@ class LoncapaResponse(six.with_metaclass(abc.ABCMeta, object)): # By default, we set this to False, allowing subclasses to override as appropriate. multi_device_support = False - def __init__(self, xml, inputfields, context, system, capa_module, minimal_init): + def __init__(self, xml, inputfields, context, system, capa_block, minimal_init): """ Init is passed the following arguments: @@ -170,13 +170,13 @@ def __init__(self, xml, inputfields, context, system, capa_module, minimal_init) - inputfields : ordered list of ElementTrees for each input entry field in this Response - context : script processor context - system : LoncapaSystem instance which provides OS, rendering, and user context - - capa_module : Capa module, to access runtime + - capa_block : Capa block, to access runtime """ self.xml = xml self.inputfields = inputfields self.context = context self.capa_system = system - self.capa_module = capa_module # njp, note None + self.capa_block = capa_block # njp, note None self.id = xml.get('id') @@ -373,7 +373,7 @@ def make_hint_div(self, hint_node, correct, student_answer, question_tag, # This is the "feedback hint" event event_info = {} - event_info['module_id'] = text_type(self.capa_module.location) + event_info['module_id'] = text_type(self.capa_block.location) event_info['problem_part_id'] = self.id event_info['trigger_type'] = 'single' # maybe be overwritten by log_extra event_info['hint_label'] = label @@ -383,7 +383,7 @@ def make_hint_div(self, hint_node, correct, student_answer, question_tag, event_info['question_type'] = question_tag if log_extra: event_info.update(log_extra) - self.capa_module.runtime.publish(self.capa_module, 'edx.problem.hint.feedback_displayed', event_info) + self.capa_block.runtime.publish(self.capa_block, 'edx.problem.hint.feedback_displayed', event_info) # Form the div-wrapped hint texts hints_wrap = HTML('').join( @@ -486,8 +486,8 @@ def get_hints(self, student_answers, new_cmap, old_cmap): globals_dict, python_path=self.context['python_path'], extra_files=self.context['extra_files'], - limit_overrides_context=get_course_id_from_capa_module( - self.capa_module + limit_overrides_context=get_course_id_from_capa_block( + self.capa_block ), slug=self.id, random_seed=self.context['seed'], @@ -985,7 +985,7 @@ class MultipleChoiceResponse(LoncapaResponse): whole software stack works with just the one system of naming. The .has_mask() test on a response checks for masking, implemented by a ._has_mask attribute on the response object. - The logging functionality in capa_module calls the unmask functions here + The logging functionality in capa_block calls the unmask functions here to translate back to choice_0 name style for recording in the logs, so the logging is in terms of the regular names. """ diff --git a/xmodule/capa/tests/helpers.py b/xmodule/capa/tests/helpers.py index 6c6106f22312..ecb94d6283fc 100644 --- a/xmodule/capa/tests/helpers.py +++ b/xmodule/capa/tests/helpers.py @@ -83,9 +83,9 @@ def test_capa_system(render_template=None): return the_system -def mock_capa_module(): +def mock_capa_block(): """ - capa response types needs just two things from the capa_module: location and publish. + capa response types needs just two things from the capa_block: location and publish. """ def mock_location_text(self): # lint-amnesty, pylint: disable=unused-argument """ @@ -93,21 +93,21 @@ def mock_location_text(self): # lint-amnesty, pylint: disable=unused-argument """ return 'i4x://Foo/bar/mock/abc' - capa_module = Mock() + capa_block = Mock() if six.PY2: - capa_module.location.__unicode__ = mock_location_text + capa_block.location.__unicode__ = mock_location_text else: - capa_module.location.__str__ = mock_location_text + capa_block.location.__str__ = mock_location_text # The following comes into existence by virtue of being called - # capa_module.runtime.publish - return capa_module + # capa_block.runtime.publish + return capa_block def new_loncapa_problem(xml, problem_id='1', capa_system=None, seed=723, use_capa_render_template=False): """Construct a `LoncapaProblem` suitable for unit tests.""" render_template = capa_render_template if use_capa_render_template else None return LoncapaProblem(xml, id=problem_id, seed=seed, capa_system=capa_system or test_capa_system(render_template), - capa_module=mock_capa_module()) + capa_block=mock_capa_block()) def load_fixture(relpath): diff --git a/xmodule/capa/tests/response_xml_factory.py b/xmodule/capa/tests/response_xml_factory.py index 33ce4b39727c..3cef8b1345ef 100644 --- a/xmodule/capa/tests/response_xml_factory.py +++ b/xmodule/capa/tests/response_xml_factory.py @@ -359,7 +359,7 @@ def create_input_element(self, **kwargs): Although can have several attributes, (*height*, *width*, *parts*, *analyses*, *submit_analysis*, and *initial_value*), - none of them are used in the capa module. + none of them are used in the capa block. For testing, we create a bare-bones version of .""" return etree.Element("schematic") diff --git a/xmodule/capa/tests/test_hint_functionality.py b/xmodule/capa/tests/test_hint_functionality.py index 2fefc046a848..4de183e4cf97 100644 --- a/xmodule/capa/tests/test_hint_functionality.py +++ b/xmodule/capa/tests/test_hint_functionality.py @@ -48,10 +48,10 @@ class TextInputHintsTest(HintTest): def test_tracking_log(self): """Test that the tracking log comes out right.""" - self.problem.capa_module.reset_mock() + self.problem.capa_block.reset_mock() self.get_hint('1_3_1', 'Blue') - self.problem.capa_module.runtime.publish.assert_called_with( - self.problem.capa_module, + self.problem.capa_block.runtime.publish.assert_called_with( + self.problem.capa_block, 'edx.problem.hint.feedback_displayed', {'module_id': 'i4x://Foo/bar/mock/abc', 'problem_part_id': '1_2', @@ -224,8 +224,8 @@ class NumericInputHintsTest(HintTest): def test_tracking_log(self): self.get_hint('1_2_1', '1.141') - self.problem.capa_module.runtime.publish.assert_called_with( - self.problem.capa_module, + self.problem.capa_block.runtime.publish.assert_called_with( + self.problem.capa_block, 'edx.problem.hint.feedback_displayed', {'module_id': 'i4x://Foo/bar/mock/abc', 'problem_part_id': '1_1', 'trigger_type': 'single', 'hint_label': 'Nice', @@ -363,8 +363,8 @@ def test_tracking_log(self): """Test checkbox tracking log - by far the most complicated case""" # A -> 1 hint self.get_hint('1_2_1', ['choice_0']) - self.problem.capa_module.runtime.publish.assert_called_with( - self.problem.capa_module, + self.problem.capa_block.runtime.publish.assert_called_with( + self.problem.capa_block, 'edx.problem.hint.feedback_displayed', {'hint_label': 'Incorrect:', 'module_id': 'i4x://Foo/bar/mock/abc', @@ -378,10 +378,10 @@ def test_tracking_log(self): ) # B C -> 2 hints - self.problem.capa_module.runtime.publish.reset_mock() + self.problem.capa_block.runtime.publish.reset_mock() self.get_hint('1_2_1', ['choice_1', 'choice_2']) - self.problem.capa_module.runtime.publish.assert_called_with( - self.problem.capa_module, + self.problem.capa_block.runtime.publish.assert_called_with( + self.problem.capa_block, 'edx.problem.hint.feedback_displayed', {'hint_label': 'Incorrect:', 'module_id': 'i4x://Foo/bar/mock/abc', @@ -398,10 +398,10 @@ def test_tracking_log(self): ) # A C -> 1 Compound hint - self.problem.capa_module.runtime.publish.reset_mock() + self.problem.capa_block.runtime.publish.reset_mock() self.get_hint('1_2_1', ['choice_0', 'choice_2']) - self.problem.capa_module.runtime.publish.assert_called_with( - self.problem.capa_module, + self.problem.capa_block.runtime.publish.assert_called_with( + self.problem.capa_block, 'edx.problem.hint.feedback_displayed', {'hint_label': 'Correct:', 'module_id': 'i4x://Foo/bar/mock/abc', @@ -428,10 +428,10 @@ class MultpleChoiceHintsTest(HintTest): def test_tracking_log(self): """Test that the tracking log comes out right.""" - self.problem.capa_module.reset_mock() + self.problem.capa_block.reset_mock() self.get_hint('1_3_1', 'choice_2') - self.problem.capa_module.runtime.publish.assert_called_with( - self.problem.capa_module, + self.problem.capa_block.runtime.publish.assert_called_with( + self.problem.capa_block, 'edx.problem.hint.feedback_displayed', {'module_id': 'i4x://Foo/bar/mock/abc', 'problem_part_id': '1_2', 'trigger_type': 'single', 'student_answer': ['choice_2'], 'correctness': False, 'question_type': 'multiplechoiceresponse', @@ -469,10 +469,10 @@ class MultpleChoiceHintsWithHtmlTest(HintTest): def test_tracking_log(self): """Test that the tracking log comes out right.""" - self.problem.capa_module.reset_mock() + self.problem.capa_block.reset_mock() self.get_hint('1_2_1', 'choice_0') - self.problem.capa_module.runtime.publish.assert_called_with( - self.problem.capa_module, + self.problem.capa_block.runtime.publish.assert_called_with( + self.problem.capa_block, 'edx.problem.hint.feedback_displayed', {'module_id': 'i4x://Foo/bar/mock/abc', 'problem_part_id': '1_1', 'trigger_type': 'single', 'student_answer': ['choice_0'], 'correctness': False, 'question_type': 'multiplechoiceresponse', @@ -503,10 +503,10 @@ class DropdownHintsTest(HintTest): def test_tracking_log(self): """Test that the tracking log comes out right.""" - self.problem.capa_module.reset_mock() + self.problem.capa_block.reset_mock() self.get_hint('1_3_1', 'FACES') - self.problem.capa_module.runtime.publish.assert_called_with( - self.problem.capa_module, + self.problem.capa_block.runtime.publish.assert_called_with( + self.problem.capa_block, 'edx.problem.hint.feedback_displayed', {'module_id': 'i4x://Foo/bar/mock/abc', 'problem_part_id': '1_2', 'trigger_type': 'single', 'student_answer': ['FACES'], 'correctness': True, 'question_type': 'optionresponse', diff --git a/xmodule/capa/util.py b/xmodule/capa/util.py index d9d517046841..163a1c86ea30 100644 --- a/xmodule/capa/util.py +++ b/xmodule/capa/util.py @@ -224,28 +224,28 @@ def remove_markup(html): return HTML(bleach.clean(html, tags=[], strip=True)) -def get_course_id_from_capa_module(capa_module): +def get_course_id_from_capa_block(capa_block): """ - Extract a stringified course run key from a CAPA module (aka ProblemBlock). + Extract a stringified course run key from a CAPA block (aka ProblemBlock). This is a bit of a hack. Its intended use is to allow us to pass the course id (if available) to `safe_exec`, enabling course-run-specific resource limits in the safe execution environment (codejail). Arguments: - capa_module (ProblemBlock|None) + capa_block (ProblemBlock|None) Returns: str|None The stringified course run key of the module. If not available, fall back to None. """ - if not capa_module: + if not capa_block: return None try: - return str(capa_module.scope_ids.usage_id.course_key) + return str(capa_block.scope_ids.usage_id.course_key) except (AttributeError, TypeError): # AttributeError: - # If the capa module lacks scope ids or has unexpected scope ids, we + # If the capa block lacks scope ids or has unexpected scope ids, we # would rather fall back to `None` than let an AttributeError be raised # here. # TypeError: diff --git a/xmodule/capa_module.py b/xmodule/capa_block.py similarity index 99% rename from xmodule/capa_module.py rename to xmodule/capa_block.py index dde79485f51e..422bcbb64395 100644 --- a/xmodule/capa_module.py +++ b/xmodule/capa_block.py @@ -547,7 +547,7 @@ def problem_types(self): try: tree = etree.XML(self.data) except etree.XMLSyntaxError: - log.error(f'Error parsing problem types from xml for capa module {self.display_name}') + log.error(f'Error parsing problem types from xml for capa block {self.display_name}') return None # short-term fix to prevent errors (TNL-5057). Will be more properly addressed in TNL-4525. registered_tags = responsetypes.registry.registered_tags() return {node.tag for node in tree.iter() if node.tag in registered_tags} @@ -638,7 +638,7 @@ def max_score(self): problem_text=self.data, id=self.location.html_id(), capa_system=capa_system, - capa_module=self, + capa_block=self, state={}, seed=1, minimal_init=True, @@ -708,7 +708,7 @@ def generate_report_data(self, user_state_iterator, limit_responses=None): id=self.location.html_id(), capa_system=capa_system, # We choose to run without a fully initialized CapaModule - capa_module=None, + capa_block=None, state={ 'done': user_state.state.get('done'), 'correct_map': user_state.state.get('correct_map'), @@ -849,7 +849,7 @@ def new_lcp(self, state, text=None): state=state, seed=self.get_seed(), capa_system=capa_system, - capa_module=self, # njp + capa_block=self, # njp ) def get_state_for_lcp(self): @@ -1070,7 +1070,7 @@ def handle_problem_html_error(self, err): if self.debug: msg = HTML( - '[courseware.capa.capa_module] ' + '[courseware.capa.capa_block] ' 'Failed to generate HTML for problem {url}' ).format( url=str(self.location) @@ -1786,7 +1786,7 @@ def submit_problem(self, data, override_time=False): except (StudentInputError, ResponseError, LoncapaProblemError) as inst: if self.debug: log.warning( - "StudentInputError in capa_module:problem_check", + "StudentInputError in capa_block:problem_check", exc_info=True ) @@ -2174,7 +2174,7 @@ def rescore(self, only_if_higher=False): self.update_correctness() calculated_score = self.calculate_score() except (StudentInputError, ResponseError, LoncapaProblemError) as inst: # lint-amnesty, pylint: disable=unused-variable - log.warning("Input error in capa_module:problem_rescore", exc_info=True) + log.warning("Input error in capa_block:problem_rescore", exc_info=True) event_info['failure'] = 'input_error' self.publish_unmasked('problem_rescore_fail', event_info) raise diff --git a/xmodule/library_tools.py b/xmodule/library_tools.py index fd99f41dbd49..c0bfd48d4b29 100644 --- a/xmodule/library_tools.py +++ b/xmodule/library_tools.py @@ -14,7 +14,7 @@ from openedx.core.djangoapps.xblock.api import load_block from openedx.core.lib import blockstore_api from common.djangoapps.student.auth import has_studio_write_access -from xmodule.capa_module import ProblemBlock +from xmodule.capa_block import ProblemBlock from xmodule.library_content_module import ANY_CAPA_TYPE_VALUE from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.exceptions import ItemNotFoundError diff --git a/xmodule/modulestore/split_mongo/split.py b/xmodule/modulestore/split_mongo/split.py index 2cd460581566..d53e6a0c23ad 100644 --- a/xmodule/modulestore/split_mongo/split.py +++ b/xmodule/modulestore/split_mongo/split.py @@ -2455,12 +2455,12 @@ def _copy_from_template( new_block_info.defaults = new_block_info.fields # - # CAPA modules store their 'markdown' value (an alternate representation of their content) + # CAPA blocks store their 'markdown' value (an alternate representation of their content) # in Scope.settings rather than Scope.content :-/ # markdown is a field that really should not be overridable - it fundamentally changes the content. - # capa modules also use a custom editor that always saves their markdown field to the metadata, + # capa blocks also use a custom editor that always saves their markdown field to the metadata, # even if it hasn't changed, which breaks our override system. - # So until capa modules are fixed, we special-case them and remove their markdown fields, + # So until capa blocks are fixed, we special-case them and remove their markdown fields, # forcing the inherited version to use XML only. if usage_key.block_type == 'problem' and 'markdown' in new_block_info.defaults: del new_block_info.defaults['markdown'] diff --git a/xmodule/modulestore/tests/test_split_copy_from_template.py b/xmodule/modulestore/tests/test_split_copy_from_template.py index 2d0377ddfadd..3fc0bcd85a72 100644 --- a/xmodule/modulestore/tests/test_split_copy_from_template.py +++ b/xmodule/modulestore/tests/test_split_copy_from_template.py @@ -59,7 +59,7 @@ def test_copy_from_template(self, source_type): problem_block_course = self.store.get_item(vertical_block_course.children[0]) assert problem_block_course.display_name == problem_library_display_name - # Check that when capa modules are copied, their "markdown" fields (Scope.settings) are removed. + # Check that when capa blocks are copied, their "markdown" fields (Scope.settings) are removed. # (See note in split.py:copy_from_template()) assert problem_block.markdown is not None assert problem_block_course.markdown is None diff --git a/xmodule/static_content.py b/xmodule/static_content.py index b2f28411bdb9..b89d225a1bf4 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -20,7 +20,7 @@ from path import Path as path from xmodule.annotatable_block import AnnotatableBlock -from xmodule.capa_module import ProblemBlock +from xmodule.capa_block import ProblemBlock from xmodule.conditional_module import ConditionalBlock from xmodule.html_module import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock from xmodule.library_content_module import LibraryContentBlock diff --git a/xmodule/tests/test_capa_module.py b/xmodule/tests/test_capa_block.py similarity index 99% rename from xmodule/tests/test_capa_module.py rename to xmodule/tests/test_capa_block.py index 4e8a91086954..ac9726a0bcfe 100644 --- a/xmodule/tests/test_capa_module.py +++ b/xmodule/tests/test_capa_block.py @@ -33,10 +33,10 @@ from xmodule.capa.correctmap import CorrectMap from xmodule.capa.responsetypes import LoncapaProblemError, ResponseError, StudentInputError from xmodule.capa.xqueue_interface import XQueueInterface -from xmodule.capa_module import ComplexEncoder, ProblemBlock +from xmodule.capa_block import ComplexEncoder, ProblemBlock from xmodule.tests import DATA_DIR -from ..capa_module import RANDOMIZATION, SHOWANSWER +from ..capa_block import RANDOMIZATION, SHOWANSWER from . import get_test_system @@ -218,7 +218,7 @@ def test_correct(self): def test_get_score(self): """ Tests the internals of get_score. In keeping with the ScorableXBlock spec, - Capa modules store their score independently of the LCP internals, so it must + Capa blocks store their score independently of the LCP internals, so it must be explicitly updated. """ student_answers = {'1_2_1': 'abcd'} @@ -705,7 +705,7 @@ def test_submit_problem_correct(self): # what the input is, by patching CorrectMap.is_correct() # Also simulate rendering the HTML with patch('xmodule.capa.correctmap.CorrectMap.is_correct') as mock_is_correct: - with patch('xmodule.capa_module.ProblemBlock.get_problem_html') as mock_html: + with patch('xmodule.capa_block.ProblemBlock.get_problem_html') as mock_html: mock_is_correct.return_value = True mock_html.return_value = "Test HTML" @@ -749,7 +749,7 @@ def test_submit_problem_closed(self): # Problem closed -- cannot submit # Simulate that ProblemBlock.closed() always returns True - with patch('xmodule.capa_module.ProblemBlock.closed') as mock_closed: + with patch('xmodule.capa_block.ProblemBlock.closed') as mock_closed: mock_closed.return_value = True with pytest.raises(xmodule.exceptions.NotFoundError): get_request_dict = {CapaFactory.input_key(): '3.14'} @@ -902,7 +902,7 @@ def test_submit_problem_with_files_as_xblock(self, mock_xqueue_post): def test_submit_problem_error(self): - # Try each exception that capa_module should handle + # Try each exception that capa_block should handle exception_classes = [StudentInputError, LoncapaProblemError, ResponseError] @@ -929,7 +929,7 @@ def test_submit_problem_error(self): def test_submit_problem_error_with_codejail_exception(self): - # Try each exception that capa_module should handle + # Try each exception that capa_block should handle exception_classes = [StudentInputError, LoncapaProblemError, ResponseError] @@ -999,7 +999,7 @@ def test_submit_problem_zero_max_grade(self): def test_submit_problem_error_nonascii(self): - # Try each exception that capa_module should handle + # Try each exception that capa_block should handle exception_classes = [StudentInputError, LoncapaProblemError, ResponseError] @@ -1026,7 +1026,7 @@ def test_submit_problem_error_nonascii(self): def test_submit_problem_error_with_staff_user(self): - # Try each exception that capa module should handle + # Try each exception that capa block should handle for exception_class in [StudentInputError, LoncapaProblemError, ResponseError]: @@ -1088,7 +1088,7 @@ def test_reset_problem(self): module.choose_new_seed = Mock(wraps=module.choose_new_seed) # Stub out HTML rendering - with patch('xmodule.capa_module.ProblemBlock.get_problem_html') as mock_html: + with patch('xmodule.capa_block.ProblemBlock.get_problem_html') as mock_html: mock_html.return_value = "
Test HTML
" # Reset the problem @@ -1110,7 +1110,7 @@ def test_reset_problem_closed(self): module = CapaFactory.create(rerandomize=RANDOMIZATION.ALWAYS) # Simulate that the problem is closed - with patch('xmodule.capa_module.ProblemBlock.closed') as mock_closed: + with patch('xmodule.capa_block.ProblemBlock.closed') as mock_closed: mock_closed.return_value = True # Try to reset the problem @@ -1302,7 +1302,7 @@ def test_save_problem_closed(self): module = CapaFactory.create(done=False) # Simulate that the problem is closed - with patch('xmodule.capa_module.ProblemBlock.closed') as mock_closed: + with patch('xmodule.capa_block.ProblemBlock.closed') as mock_closed: mock_closed.return_value = True # Try to save the problem @@ -1931,8 +1931,8 @@ def test_random_seed_bins(self, rerandomize): assert 0 <= module.seed < 1000 i -= 1 - @patch('xmodule.capa_module.log') - @patch('xmodule.capa_module.Progress') + @patch('xmodule.capa_block.log') + @patch('xmodule.capa_block.Progress') def test_get_progress_error(self, mock_progress, mock_log): """ Check that an exception given in `Progress` produces a `log.exception` call. @@ -1945,7 +1945,7 @@ def test_get_progress_error(self, mock_progress, mock_log): mock_log.exception.assert_called_once_with('Got bad progress') mock_log.reset_mock() - @patch('xmodule.capa_module.Progress') + @patch('xmodule.capa_block.Progress') def test_get_progress_no_error_if_weight_zero(self, mock_progress): """ Check that if the weight is 0 get_progress does not try to create a Progress object. @@ -1957,7 +1957,7 @@ def test_get_progress_no_error_if_weight_zero(self, mock_progress): assert progress is None assert not mock_progress.called - @patch('xmodule.capa_module.Progress') + @patch('xmodule.capa_block.Progress') def test_get_progress_calculate_progress_fraction(self, mock_progress): """ Check that score and total are calculated correctly for the progress fraction. @@ -3266,7 +3266,7 @@ def test_generate_report_data_skip_dynamath(self): def test_generate_report_data_report_loncapa_error(self): #Test to make sure reports continue despite loncappa errors, and write them into the report. descriptor = self._get_descriptor() - with patch('xmodule.capa_module.LoncapaProblem') as mock_LoncapaProblem: + with patch('xmodule.capa_block.LoncapaProblem') as mock_LoncapaProblem: mock_LoncapaProblem.side_effect = LoncapaProblemError report_data = list(descriptor.generate_report_data( self._mock_user_state_generator( diff --git a/xmodule/tests/test_delay_between_attempts.py b/xmodule/tests/test_delay_between_attempts.py index fd1afccdb849..871156665a42 100644 --- a/xmodule/tests/test_delay_between_attempts.py +++ b/xmodule/tests/test_delay_between_attempts.py @@ -1,9 +1,9 @@ """ Tests the logic of problems with a delay between attempt submissions. -Note that this test file is based off of test_capa_module.py and as +Note that this test file is based off of test_capa_block.py and as such, uses the same CapaFactory problem setup to test the functionality -of the submit_problem method of a capa module when the "delay between quiz +of the submit_problem method of a capa block when the "delay between quiz submissions" setting is set to different values """ @@ -21,7 +21,7 @@ from xblock.scorable import Score import xmodule -from xmodule.capa_module import ProblemBlock +from xmodule.capa_block import ProblemBlock from . import get_test_system @@ -30,7 +30,7 @@ class CapaFactoryWithDelay: """ Create problem modules class, specialized for delay_between_attempts test cases. This factory seems different enough from the one in - test_capa_module that unifying them is unattractive. + test_capa_block that unifying them is unattractive. Removed the unused optional arguments. """ diff --git a/xmodule/tests/test_library_content.py b/xmodule/tests/test_library_content.py index 3e1785746b46..9fdcc494efc2 100644 --- a/xmodule/tests/test_library_content.py +++ b/xmodule/tests/test_library_content.py @@ -22,7 +22,7 @@ from xmodule.tests import get_test_system from xmodule.validation import StudioValidationMessage from xmodule.x_module import AUTHOR_VIEW -from xmodule.capa_module import ProblemBlock +from xmodule.capa_block import ProblemBlock from .test_course_module import DummySystem as TestImportSystem From 7e33dce1ab828de87c140bf0f3802cafc5cf9996 Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:01:43 +0200 Subject: [PATCH 03/25] refactor: xmodule/conditional_module.py -> xmodule/conditional_block.py --- .../contentstore/tests/test_import.py | 8 +++---- .../contentstore/views/tests/test_preview.py | 4 ++-- ...nal_module.html => conditional_block.html} | 2 +- setup.py | 2 +- xmodule/capa_block.py | 4 ++-- ...itional_module.py => conditional_block.py} | 12 +++++----- xmodule/static_content.py | 2 +- xmodule/tests/test_conditional.py | 22 +++++++++---------- 8 files changed, 28 insertions(+), 28 deletions(-) rename lms/templates/{conditional_module.html => conditional_block.html} (91%) rename xmodule/{conditional_module.py => conditional_block.py} (97%) diff --git a/cms/djangoapps/contentstore/tests/test_import.py b/cms/djangoapps/contentstore/tests/test_import.py index 0f8066793872..4994ba1180ab 100644 --- a/cms/djangoapps/contentstore/tests/test_import.py +++ b/cms/djangoapps/contentstore/tests/test_import.py @@ -192,24 +192,24 @@ def test_rewrite_reference_list(self): ['conditional'], target_id=target_id ) - conditional_module = module_store.get_item( + conditional_block = module_store.get_item( target_id.make_usage_key('conditional', 'condone') ) - self.assertIsNotNone(conditional_module) + self.assertIsNotNone(conditional_block) different_course_id = module_store.make_course_key('edX', 'different_course', None) self.assertListEqual( [ target_id.make_usage_key('problem', 'choiceprob'), different_course_id.make_usage_key('html', 'for_testing_import_rewrites') ], - conditional_module.sources_list + conditional_block.sources_list ) self.assertListEqual( [ target_id.make_usage_key('html', 'congrats'), target_id.make_usage_key('html', 'secret_page') ], - conditional_module.show_tag_list + conditional_block.show_tag_list ) def test_rewrite_reference_value_dict_published(self): diff --git a/cms/djangoapps/contentstore/views/tests/test_preview.py b/cms/djangoapps/contentstore/views/tests/test_preview.py index a46f35cef5f3..0a0018854d39 100644 --- a/cms/djangoapps/contentstore/views/tests/test_preview.py +++ b/cms/djangoapps/contentstore/views/tests/test_preview.py @@ -118,8 +118,8 @@ def test_preview_no_asides(self): self.assertNotRegex(html, r"data-block-type=[\"\']test_aside[\"\']") self.assertNotRegex(html, "Aside rendered") - @mock.patch('xmodule.conditional_module.ConditionalBlock.is_condition_satisfied') - def test_preview_conditional_module_children_context(self, mock_is_condition_satisfied): + @mock.patch('xmodule.conditional_block.ConditionalBlock.is_condition_satisfied') + def test_preview_conditional_block_children_context(self, mock_is_condition_satisfied): """ Tests that when empty context is pass to children of ConditionalBlock it will not raise KeyError. """ diff --git a/lms/templates/conditional_module.html b/lms/templates/conditional_block.html similarity index 91% rename from lms/templates/conditional_module.html rename to lms/templates/conditional_block.html index 06a055e2a015..0b6c348cbd69 100644 --- a/lms/templates/conditional_module.html +++ b/lms/templates/conditional_block.html @@ -19,7 +19,7 @@

${_message(reqm, message)}

% else:

- ${_("You do not have access to this dependency module.")} + ${_("You do not have access to this dependency block.")}

% endif % endfor diff --git a/setup.py b/setup.py index a614cfd90334..619cfe578a0a 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ "book = xmodule.template_module:TranslateCustomTagBlock", "annotatable = xmodule.annotatable_block:AnnotatableBlock", "chapter = xmodule.seq_module:SectionBlock", - "conditional = xmodule.conditional_module:ConditionalBlock", + "conditional = xmodule.conditional_block:ConditionalBlock", "course = xmodule.course_module:CourseBlock", "course_info = xmodule.html_module:CourseInfoBlock", "customtag = xmodule.template_module:CustomTagBlock", diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py index 422bcbb64395..e2496bf2cedf 100644 --- a/xmodule/capa_block.py +++ b/xmodule/capa_block.py @@ -1410,14 +1410,14 @@ def is_submitted(self): Problem can be completely wrong. Pressing RESET button makes this function to return False. """ - # used by conditional module + # used by conditional block return self.lcp.done def is_attempted(self): """ Has the problem been attempted? - used by conditional module + used by conditional block """ return self.attempts > 0 diff --git a/xmodule/conditional_module.py b/xmodule/conditional_block.py similarity index 97% rename from xmodule/conditional_module.py rename to xmodule/conditional_block.py index 238d5564fffd..54b8f6ca6c93 100644 --- a/xmodule/conditional_module.py +++ b/xmodule/conditional_block.py @@ -102,7 +102,7 @@ class ConditionalBlock( sources_list = ReferenceList( display_name=_("Source Components"), help=_("The component location IDs of all source components that are used to determine whether a learner is " - "shown the content of this conditional module. Copy the component location ID of a component from its " + "shown the content of this conditional block. Copy the component location ID of a component from its " "Settings dialog in Studio."), scope=Scope.content ) @@ -110,7 +110,7 @@ class ConditionalBlock( conditional_attr = String( display_name=_("Conditional Attribute"), help=_("The attribute of the source components that determines whether a learner is shown the content of this " - "conditional module."), + "conditional block."), scope=Scope.content, default='correct', values=lambda: [{'display_name': xml_attr, 'value': xml_attr} @@ -120,7 +120,7 @@ class ConditionalBlock( conditional_value = String( display_name=_("Conditional Value"), help=_("The value that the conditional attribute of the source components must match before a learner is shown " - "the content of this conditional module."), + "the content of this conditional block."), scope=Scope.content, default='True' ) @@ -128,7 +128,7 @@ class ConditionalBlock( conditional_message = String( display_name=_("Blocked Content Message"), help=_("The message that is shown to learners when not all conditions are met to show the content of this " - "conditional module. Include {link} in the text of your message to give learners a direct link to " + "conditional block. Include {link} in the text of your message to give learners a direct link to " "required units. For example, 'You must complete {link} before you can access this unit'."), scope=Scope.content, default=_('You must complete {link} before you can access this unit.') @@ -219,7 +219,7 @@ def is_condition_satisfied(self): # lint-amnesty, pylint: disable=missing-funct if module is not None: # We do not want to log when module is None, and it is when requester # does not have access to the requested required module. - log.warning('Error in conditional module: \ + log.warning('Error in conditional block: \ required module {module} has no {module_attr}'.format(module=module, module_attr=attr_name)) return False @@ -284,7 +284,7 @@ def handle_ajax(self, _dispatch, _data): if not self.is_condition_satisfied(): context = {'module': self, 'message': self.conditional_message} - html = self.runtime.service(self, 'mako').render_template('conditional_module.html', context) + html = self.runtime.service(self, 'mako').render_template('conditional_block.html', context) return json.dumps({'fragments': [{'content': html}], 'message': bool(self.conditional_message)}) fragments = [child.render(STUDENT_VIEW).to_dict() for child in self.get_display_items()] diff --git a/xmodule/static_content.py b/xmodule/static_content.py index b89d225a1bf4..0aee38db3a08 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -21,7 +21,7 @@ from xmodule.annotatable_block import AnnotatableBlock from xmodule.capa_block import ProblemBlock -from xmodule.conditional_module import ConditionalBlock +from xmodule.conditional_block import ConditionalBlock from xmodule.html_module import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock from xmodule.library_content_module import LibraryContentBlock from xmodule.lti_module import LTIBlock diff --git a/xmodule/tests/test_conditional.py b/xmodule/tests/test_conditional.py index 6783ec7a3303..00abe5f34050 100644 --- a/xmodule/tests/test_conditional.py +++ b/xmodule/tests/test_conditional.py @@ -13,7 +13,7 @@ from xblock.field_data import DictFieldData from xblock.fields import ScopeIds -from xmodule.conditional_module import ConditionalBlock +from xmodule.conditional_block import ConditionalBlock from xmodule.error_module import ErrorBlock from xmodule.modulestore.xml import CourseLocationManager, ImportSystem, XMLModuleStore from xmodule.tests import DATA_DIR, get_test_descriptor_system, get_test_system @@ -54,7 +54,7 @@ class ConditionalBlockFactory(xml.XmlImportFactory): class ConditionalFactory: """ - A helper class to create a conditional module and associated source and child modules + A helper class to create a conditional block and associated source and child blocks to allow for testing. """ @staticmethod @@ -114,7 +114,7 @@ def load_item(usage_id, for_parent=None): # pylint: disable=unused-argument system.descriptor_runtime = descriptor_system - # construct conditional module: + # construct conditional block: cond_location = BlockUsageLocator(CourseLocator("edX", "conditional_test", "test_run", deprecated=True), "conditional", "SampleConditional", deprecated=True) field_data = DictFieldData({ @@ -144,8 +144,8 @@ def load_item(usage_id, for_parent=None): # pylint: disable=unused-argument class ConditionalBlockBasicTest(unittest.TestCase): """ - Make sure that conditional module works, using mocks for - other modules. + Make sure that conditional block works, using mocks for + other blocks. """ def setUp(self): @@ -200,7 +200,7 @@ def test_error_as_source(self): fragments = ajax['fragments'] assert not any(('This is a secret' in item['content']) for item in fragments) - @patch('xmodule.conditional_module.log') + @patch('xmodule.conditional_block.log') def test_conditional_with_staff_only_source_module(self, mock_log): modules = ConditionalFactory.create( self.test_system, @@ -233,8 +233,8 @@ def get_module_for_location(self, location): @patch('xmodule.x_module.descriptor_global_local_resource_url') @patch.dict(settings.FEATURES, {'ENABLE_EDXNOTES': False}) - def test_conditional_module(self, _): - """Make sure that conditional module works""" + def test_conditional_block(self, _): + """Make sure that conditional block works""" # edx - HarvardX # cond_test - ER22x location = BlockUsageLocator(CourseLocator("HarvardX", "ER22x", "2013_Spring", deprecated=True), @@ -268,7 +268,7 @@ def test_conditional_module(self, _): fragments = ajax['fragments'] assert any(('This is a secret' in item['content']) for item in fragments) - def test_conditional_module_with_empty_sources_list(self): + def test_conditional_block_with_empty_sources_list(self): """ If a ConditionalBlock is initialized with an empty sources_list, we assert that the sources_list is set via generating UsageKeys from the values in xml_attributes['sources'] @@ -292,7 +292,7 @@ def test_conditional_module_with_empty_sources_list(self): assert conditional.sources_list[0] == BlockUsageLocator.from_string(conditional.xml_attributes['sources'])\ .replace(run=dummy_location.course_key.run) - def test_conditional_module_parse_sources(self): + def test_conditional_block_parse_sources(self): dummy_system = Mock() dummy_location = BlockUsageLocator(CourseLocator("edX", "conditional_test", "test_run"), "conditional", "SampleConditional") @@ -310,7 +310,7 @@ def test_conditional_module_parse_sources(self): assert conditional.parse_sources(conditional.xml_attributes) == ['i4x://HarvardX/ER22x/poll_question/T15_poll', 'i4x://HarvardX/ER22x/poll_question/T16_poll'] - def test_conditional_module_parse_attr_values(self): + def test_conditional_block_parse_attr_values(self): root = '' xml_object = etree.XML(root) definition = ConditionalBlock.definition_from_xml(xml_object, Mock())[0] From 0df1411636caacf673eafe9e27ac82399002c92d Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:02:17 +0200 Subject: [PATCH 04/25] refactor: xmodule/course_module.py -> xmodule/course_block.py --- .../management/commands/generate_courses.py | 2 +- .../rest_api/v0/serializers/advanced_settings.py | 2 +- .../contentstore/rest_api/v1/serializers.py | 2 +- cms/djangoapps/contentstore/rest_api/v1/views.py | 2 +- cms/djangoapps/contentstore/tasks.py | 2 +- .../contentstore/tests/test_contentstore.py | 6 +++--- .../contentstore/tests/test_course_create_rerun.py | 2 +- .../contentstore/tests/test_course_listing.py | 2 +- cms/djangoapps/contentstore/tests/test_crud.py | 2 +- cms/djangoapps/contentstore/views/course.py | 4 ++-- cms/djangoapps/contentstore/views/item.py | 2 +- cms/djangoapps/contentstore/views/tabs.py | 2 +- .../contentstore/views/tests/test_item.py | 2 +- cms/djangoapps/models/settings/course_metadata.py | 2 +- lms/djangoapps/course_api/blocks/permissions.py | 2 +- .../course_api/tests/test_serializers.py | 2 +- .../course_home_api/outline/tests/test_view.py | 2 +- lms/djangoapps/course_home_api/outline/views.py | 2 +- lms/djangoapps/courseware/access.py | 2 +- lms/djangoapps/courseware/access_utils.py | 4 ++-- lms/djangoapps/courseware/rules.py | 2 +- lms/djangoapps/courseware/tests/test_about.py | 4 ++-- lms/djangoapps/courseware/tests/test_access.py | 2 +- lms/djangoapps/courseware/tests/tests.py | 2 +- lms/djangoapps/courseware/views/index.py | 2 +- lms/djangoapps/courseware/views/views.py | 2 +- .../django_comment_client/tests/test_models.py | 2 +- lms/djangoapps/discussion/rest_api/api.py | 2 +- lms/djangoapps/mobile_api/users/tests.py | 2 +- .../djangoapps/content/course_overviews/models.py | 2 +- .../tests/test_course_overviews.py | 2 +- openedx/core/djangoapps/course_live/tab.py | 2 +- openedx/core/djangoapps/discussions/utils.py | 2 +- openedx/features/lti_course_tab/tab.py | 2 +- setup.py | 2 +- xmodule/{course_module.py => course_block.py} | 0 xmodule/modulestore/mongo/base.py | 2 +- xmodule/modulestore/split_mongo/split.py | 2 +- xmodule/modulestore/tests/factories.py | 2 +- xmodule/modulestore/tests/test_semantics.py | 2 +- .../modulestore/tests/test_split_modulestore.py | 2 +- xmodule/tests/test_course_module.py | 14 +++++++------- xmodule/tests/test_export.py | 2 +- xmodule/tests/test_xml_module.py | 2 +- 44 files changed, 54 insertions(+), 54 deletions(-) rename xmodule/{course_module.py => course_block.py} (100%) diff --git a/cms/djangoapps/contentstore/management/commands/generate_courses.py b/cms/djangoapps/contentstore/management/commands/generate_courses.py index 2161c48f397c..4a91761e0bfe 100644 --- a/cms/djangoapps/contentstore/management/commands/generate_courses.py +++ b/cms/djangoapps/contentstore/management/commands/generate_courses.py @@ -12,7 +12,7 @@ from cms.djangoapps.contentstore.management.commands.utils import user_from_str from cms.djangoapps.contentstore.views.course import create_new_course_in_store from openedx.core.djangoapps.credit.models import CreditProvider -from xmodule.course_module import CourseFields # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import CourseFields # lint-amnesty, pylint: disable=wrong-import-order from xmodule.fields import Date # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.exceptions import DuplicateCourseError # lint-amnesty, pylint: disable=wrong-import-order from xmodule.tabs import CourseTabList # lint-amnesty, pylint: disable=wrong-import-order diff --git a/cms/djangoapps/contentstore/rest_api/v0/serializers/advanced_settings.py b/cms/djangoapps/contentstore/rest_api/v0/serializers/advanced_settings.py index 76694ac618b7..0de09900e2fd 100644 --- a/cms/djangoapps/contentstore/rest_api/v0/serializers/advanced_settings.py +++ b/cms/djangoapps/contentstore/rest_api/v0/serializers/advanced_settings.py @@ -14,7 +14,7 @@ List, String, ) -from xmodule.course_module import CourseFields, EmailString +from xmodule.course_block import CourseFields, EmailString from xmodule.fields import Date from cms.djangoapps.models.settings.course_metadata import CourseMetadata diff --git a/cms/djangoapps/contentstore/rest_api/v1/serializers.py b/cms/djangoapps/contentstore/rest_api/v1/serializers.py index ee99efa31f5d..2a5f92325f31 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/serializers.py +++ b/cms/djangoapps/contentstore/rest_api/v1/serializers.py @@ -4,7 +4,7 @@ from rest_framework import serializers -from xmodule.course_module import get_available_providers +from xmodule.course_block import get_available_providers class ProctoredExamSettingsSerializer(serializers.Serializer): diff --git a/cms/djangoapps/contentstore/rest_api/v1/views.py b/cms/djangoapps/contentstore/rest_api/v1/views.py index f56a6287ab13..2b80ebeb2569 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views.py @@ -9,7 +9,7 @@ from cms.djangoapps.contentstore.views.course import get_course_and_check_access from cms.djangoapps.models.settings.course_metadata import CourseMetadata -from xmodule.course_module import get_available_providers # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import get_available_providers # lint-amnesty, pylint: disable=wrong-import-order from openedx.core.djangoapps.course_apps.toggles import exams_ida_enabled from openedx.core.lib.api.view_utils import view_auth_classes from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order diff --git a/cms/djangoapps/contentstore/tasks.py b/cms/djangoapps/contentstore/tasks.py index aaee20fbb159..fc053bb4fa1e 100644 --- a/cms/djangoapps/contentstore/tasks.py +++ b/cms/djangoapps/contentstore/tasks.py @@ -56,7 +56,7 @@ from openedx.core.djangoapps.embargo.models import CountryAccessRule, RestrictedCourse from openedx.core.lib.extract_tar import safetar_extractall from xmodule.contentstore.django import contentstore # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.course_module import CourseFields # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import CourseFields # lint-amnesty, pylint: disable=wrong-import-order from xmodule.exceptions import SerializationError # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore import COURSE_ROOT, LIBRARY_ROOT # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 5049a91e65cd..40c9e3a3e324 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -28,7 +28,7 @@ from xmodule.contentstore.content import StaticContent from xmodule.contentstore.django import contentstore from xmodule.contentstore.utils import empty_asset_trashcan, restore_asset_from_trashcan -from xmodule.course_module import CourseBlock, Textbook +from xmodule.course_block import CourseBlock, Textbook from xmodule.exceptions import InvalidVersionError from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore @@ -302,7 +302,7 @@ def verify_content_existence(self, store, root_dir, course_id, dirname, category filesystem = OSFS(root_dir / ('test_export/' + dirname)) self.assertTrue(filesystem.exists(item.location.block_id + filename_suffix)) - @mock.patch('xmodule.course_module.requests.get') + @mock.patch('xmodule.course_block.requests.get') def test_export_course_roundtrip(self, mock_get): mock_get.return_value.text = dedent(""" @@ -912,7 +912,7 @@ def test_get_depth_with_drafts(self): num_drafts = self._get_draft_counts(course) self.assertEqual(num_drafts, 1) - @mock.patch('xmodule.course_module.requests.get') + @mock.patch('xmodule.course_block.requests.get') def test_import_textbook_as_content_element(self, mock_get): mock_get.return_value.text = dedent(""" diff --git a/cms/djangoapps/contentstore/tests/test_course_create_rerun.py b/cms/djangoapps/contentstore/tests/test_course_create_rerun.py index 5d8dab906b47..0dc03417d543 100644 --- a/cms/djangoapps/contentstore/tests/test_course_create_rerun.py +++ b/cms/djangoapps/contentstore/tests/test_course_create_rerun.py @@ -16,7 +16,7 @@ from organizations.api import add_organization, get_course_organizations, get_organization_by_short_name from organizations.exceptions import InvalidOrganizationException from organizations.models import Organization -from xmodule.course_module import CourseFields +from xmodule.course_block import CourseFields from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory diff --git a/cms/djangoapps/contentstore/tests/test_course_listing.py b/cms/djangoapps/contentstore/tests/test_course_listing.py index b8d39dfd4b0a..461a1281f55d 100644 --- a/cms/djangoapps/contentstore/tests/test_course_listing.py +++ b/cms/djangoapps/contentstore/tests/test_course_listing.py @@ -35,7 +35,7 @@ from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.djangoapps.content.course_overviews.tests.factories import CourseOverviewFactory from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES -from xmodule.course_module import CourseSummary # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import CourseSummary # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.tests.factories import CourseFactory, check_mongo_calls # lint-amnesty, pylint: disable=wrong-import-order diff --git a/cms/djangoapps/contentstore/tests/test_crud.py b/cms/djangoapps/contentstore/tests/test_crud.py index f1be99b41acb..1cac18bdde00 100644 --- a/cms/djangoapps/contentstore/tests/test_crud.py +++ b/cms/djangoapps/contentstore/tests/test_crud.py @@ -3,7 +3,7 @@ from xmodule import templates from xmodule.capa_block import ProblemBlock -from xmodule.course_module import CourseBlock +from xmodule.course_block import CourseBlock from xmodule.html_module import HtmlBlock from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.exceptions import DuplicateCourseError diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 4fbf4add832a..70ebc6589348 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -77,7 +77,7 @@ from openedx.features.content_type_gating.partitions import CONTENT_TYPE_GATING_SCHEME from openedx.features.course_experience.waffle import ENABLE_COURSE_ABOUT_SIDEBAR_HTML from xmodule.contentstore.content import StaticContent # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.course_module import CourseBlock, DEFAULT_START_DATE, CourseFields # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import CourseBlock, DEFAULT_START_DATE, CourseFields # lint-amnesty, pylint: disable=wrong-import-order from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore import EdxJSONEncoder # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order @@ -907,7 +907,7 @@ def _create_or_rerun_course(request): # Set a unique wiki_slug for newly created courses. To maintain active wiki_slugs for # existing xml courses this cannot be changed in CourseBlock. # # TODO get rid of defining wiki slug in this org/course/run specific way and reconcile - # w/ xmodule.course_module.CourseBlock.__init__ + # w/ xmodule.course_block.CourseBlock.__init__ wiki_slug = f"{org}.{course}.{run}" definition_data = {'wiki_slug': wiki_slug} fields.update(definition_data) diff --git a/cms/djangoapps/contentstore/views/item.py b/cms/djangoapps/contentstore/views/item.py index 2ef9b80d38b2..52689f217b1e 100644 --- a/cms/djangoapps/contentstore/views/item.py +++ b/cms/djangoapps/contentstore/views/item.py @@ -44,7 +44,7 @@ from openedx.core.lib.gating import api as gating_api from openedx.core.lib.xblock_utils import hash_resource, request_token, wrap_xblock, wrap_xblock_aside from openedx.core.toggles import ENTRANCE_EXAMS -from xmodule.course_module import DEFAULT_START_DATE # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import DEFAULT_START_DATE # lint-amnesty, pylint: disable=wrong-import-order from xmodule.library_tools import LibraryToolsService # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore import EdxJSONEncoder, ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order diff --git a/cms/djangoapps/contentstore/views/tabs.py b/cms/djangoapps/contentstore/views/tabs.py index 72c7c90c72f1..6ccbee3aeac2 100644 --- a/cms/djangoapps/contentstore/views/tabs.py +++ b/cms/djangoapps/contentstore/views/tabs.py @@ -11,7 +11,7 @@ from django.views.decorators.http import require_http_methods from opaque_keys.edx.keys import CourseKey, UsageKey from rest_framework.exceptions import ValidationError -from xmodule.course_module import CourseBlock +from xmodule.course_block import CourseBlock from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.tabs import CourseTab, CourseTabList, InvalidTabsException, StaticTab diff --git a/cms/djangoapps/contentstore/views/tests/test_item.py b/cms/djangoapps/contentstore/views/tests/test_item.py index 6a643de54f20..97fe10687164 100644 --- a/cms/djangoapps/contentstore/views/tests/test_item.py +++ b/cms/djangoapps/contentstore/views/tests/test_item.py @@ -28,7 +28,7 @@ from xblock.test.tools import TestRuntime from xblock.validation import ValidationMessage from xmodule.capa_block import ProblemBlock -from xmodule.course_module import DEFAULT_START_DATE +from xmodule.course_block import DEFAULT_START_DATE from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError diff --git a/cms/djangoapps/models/settings/course_metadata.py b/cms/djangoapps/models/settings/course_metadata.py index 9dea9868d994..c072a4ae552b 100644 --- a/cms/djangoapps/models/settings/course_metadata.py +++ b/cms/djangoapps/models/settings/course_metadata.py @@ -18,7 +18,7 @@ from openedx.core.djangoapps.discussions.config.waffle_utils import legacy_discussion_experience_enabled from openedx.core.lib.teams_config import TeamsetType from openedx.features.course_experience import COURSE_ENABLE_UNENROLLED_ACCESS_FLAG -from xmodule.course_module import get_available_providers # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import get_available_providers # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.exceptions import InvalidProctoringProvider # lint-amnesty, pylint: disable=wrong-import-order diff --git a/lms/djangoapps/course_api/blocks/permissions.py b/lms/djangoapps/course_api/blocks/permissions.py index 45156de4114d..1fc39e9b524a 100644 --- a/lms/djangoapps/course_api/blocks/permissions.py +++ b/lms/djangoapps/course_api/blocks/permissions.py @@ -13,7 +13,7 @@ from lms.djangoapps.courseware.exceptions import CourseRunNotFound from openedx.core.djangoapps.content.course_overviews.models import \ CourseOverview # lint-amnesty, pylint: disable=unused-import -from xmodule.course_module import COURSE_VISIBILITY_PUBLIC # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import COURSE_VISIBILITY_PUBLIC # lint-amnesty, pylint: disable=wrong-import-order def can_access_all_blocks(requesting_user, course_key): diff --git a/lms/djangoapps/course_api/tests/test_serializers.py b/lms/djangoapps/course_api/tests/test_serializers.py index 5ac8a119ac1d..045f399f4ecd 100644 --- a/lms/djangoapps/course_api/tests/test_serializers.py +++ b/lms/djangoapps/course_api/tests/test_serializers.py @@ -11,7 +11,7 @@ from rest_framework.request import Request from rest_framework.test import APIRequestFactory from xblock.core import XBlock -from xmodule.course_module import DEFAULT_START_DATE +from xmodule.course_block import DEFAULT_START_DATE from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase from xmodule.modulestore.tests.factories import check_mongo_calls diff --git a/lms/djangoapps/course_home_api/outline/tests/test_view.py b/lms/djangoapps/course_home_api/outline/tests/test_view.py index c37788e9eec6..aa29bdd5591e 100644 --- a/lms/djangoapps/course_home_api/outline/tests/test_view.py +++ b/lms/djangoapps/course_home_api/outline/tests/test_view.py @@ -33,7 +33,7 @@ ENABLE_COURSE_GOALS ) from openedx.features.discounts.applicability import DISCOUNT_APPLICABILITY_FLAG -from xmodule.course_module import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order diff --git a/lms/djangoapps/course_home_api/outline/views.py b/lms/djangoapps/course_home_api/outline/views.py index 9d9e4e1cd161..253779005e91 100644 --- a/lms/djangoapps/course_home_api/outline/views.py +++ b/lms/djangoapps/course_home_api/outline/views.py @@ -49,7 +49,7 @@ from openedx.features.course_experience.url_helpers import get_learning_mfe_home_url from openedx.features.course_experience.utils import get_course_outline_block_tree, get_start_block from openedx.features.discounts.utils import generate_offer_data -from xmodule.course_module import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE # lint-amnesty, pylint: disable=wrong-import-order class UnableToDismissWelcomeMessage(APIException): diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py index a6750122cd01..b38a0230d216 100644 --- a/lms/djangoapps/courseware/access.py +++ b/lms/djangoapps/courseware/access.py @@ -61,7 +61,7 @@ get_pre_requisite_courses_not_completed, is_prerequisite_courses_enabled ) -from xmodule.course_module import CATALOG_VISIBILITY_ABOUT, CATALOG_VISIBILITY_CATALOG_AND_ABOUT, CourseBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import CATALOG_VISIBILITY_ABOUT, CATALOG_VISIBILITY_CATALOG_AND_ABOUT, CourseBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.partitions.partitions import NoSuchUserPartitionError, NoSuchUserPartitionGroupError # lint-amnesty, pylint: disable=wrong-import-order diff --git a/lms/djangoapps/courseware/access_utils.py b/lms/djangoapps/courseware/access_utils.py index 18f4bb27a8a1..6e5699f4e27a 100644 --- a/lms/djangoapps/courseware/access_utils.py +++ b/lms/djangoapps/courseware/access_utils.py @@ -24,7 +24,7 @@ ) from lms.djangoapps.courseware.masquerade import get_course_masquerade, is_masquerading_as_student from openedx.features.course_experience import COURSE_ENABLE_UNENROLLED_ACCESS_FLAG, COURSE_PRE_START_ACCESS_FLAG -from xmodule.course_module import COURSE_VISIBILITY_PUBLIC # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import COURSE_VISIBILITY_PUBLIC # lint-amnesty, pylint: disable=wrong-import-order from xmodule.util.xmodule_django import get_current_request_hostname # lint-amnesty, pylint: disable=wrong-import-order DEBUG_ACCESS = False @@ -153,7 +153,7 @@ def check_public_access(course, visibilities): This checks if the unenrolled access waffle flag for the course is set and the course visibility matches any of the input visibilities. - The "visibilities" argument is one of these constants from xmodule.course_module: + The "visibilities" argument is one of these constants from xmodule.course_block: - COURSE_VISIBILITY_PRIVATE - COURSE_VISIBILITY_PUBLIC - COURSE_VISIBILITY_PUBLIC_OUTLINE diff --git a/lms/djangoapps/courseware/rules.py b/lms/djangoapps/courseware/rules.py index 76e30b64a871..8f4d0de9817e 100644 --- a/lms/djangoapps/courseware/rules.py +++ b/lms/djangoapps/courseware/rules.py @@ -19,7 +19,7 @@ from openedx.core.djangoapps.enrollments.api import is_enrollment_valid_for_proctoring from common.djangoapps.student.models import CourseAccessRole from common.djangoapps.student.roles import CourseRole, OrgRole -from xmodule.course_module import CourseBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import CourseBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order diff --git a/lms/djangoapps/courseware/tests/test_about.py b/lms/djangoapps/courseware/tests/test_about.py index bb02a5912243..62dedf31da92 100644 --- a/lms/djangoapps/courseware/tests/test_about.py +++ b/lms/djangoapps/courseware/tests/test_about.py @@ -14,7 +14,7 @@ from django.urls import reverse from edx_toggles.toggles.testutils import override_waffle_flag, override_waffle_switch from milestones.tests.utils import MilestonesTestCaseMixin -from xmodule.course_module import ( +from xmodule.course_block import ( CATALOG_VISIBILITY_ABOUT, CATALOG_VISIBILITY_NONE, COURSE_VISIBILITY_PRIVATE, @@ -207,7 +207,7 @@ def test_about_page_public_view(self, course_visibility): Assert that anonymous or unenrolled users see View Course option when unenrolled access flag is set """ - with mock.patch('xmodule.course_module.CourseBlock.course_visibility', course_visibility): + with mock.patch('xmodule.course_block.CourseBlock.course_visibility', course_visibility): with override_waffle_flag(COURSE_ENABLE_UNENROLLED_ACCESS_FLAG, active=True): url = reverse('about_course', args=[str(self.course.id)]) resp = self.client.get(url) diff --git a/lms/djangoapps/courseware/tests/test_access.py b/lms/djangoapps/courseware/tests/test_access.py index 9b6e0e718f61..f30c823f3283 100644 --- a/lms/djangoapps/courseware/tests/test_access.py +++ b/lms/djangoapps/courseware/tests/test_access.py @@ -44,7 +44,7 @@ from common.djangoapps.student.tests.factories import StaffFactory from common.djangoapps.student.tests.factories import UserFactory from common.djangoapps.util.milestones_helpers import fulfill_course_milestone, set_prerequisite_courses -from xmodule.course_module import ( # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import ( # lint-amnesty, pylint: disable=wrong-import-order CATALOG_VISIBILITY_ABOUT, CATALOG_VISIBILITY_CATALOG_AND_ABOUT, CATALOG_VISIBILITY_NONE diff --git a/lms/djangoapps/courseware/tests/tests.py b/lms/djangoapps/courseware/tests/tests.py index 7d613721fa4f..86e5a53bbbf6 100644 --- a/lms/djangoapps/courseware/tests/tests.py +++ b/lms/djangoapps/courseware/tests/tests.py @@ -124,7 +124,7 @@ def setUp(self): self.setup_user() self.toy_course_key = ToyCourseFactory.create().id - @mock.patch('xmodule.course_module.requests.get') + @mock.patch('xmodule.course_block.requests.get') def test_toy_textbooks_loads(self, mock_get): mock_get.return_value.text = dedent(""" diff --git a/lms/djangoapps/courseware/views/index.py b/lms/djangoapps/courseware/views/index.py index d2d72eae94b1..407874112ec3 100644 --- a/lms/djangoapps/courseware/views/index.py +++ b/lms/djangoapps/courseware/views/index.py @@ -24,7 +24,7 @@ from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey, UsageKey from web_fragments.fragment import Fragment -from xmodule.course_module import COURSE_VISIBILITY_PUBLIC +from xmodule.course_block import COURSE_VISIBILITY_PUBLIC from xmodule.modulestore.django import modulestore from xmodule.x_module import PUBLIC_VIEW, STUDENT_VIEW diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index 9536640b2460..f5c6864af5bf 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -45,7 +45,7 @@ from rest_framework.response import Response from rest_framework.throttling import UserRateThrottle from web_fragments.fragment import Fragment -from xmodule.course_module import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE +from xmodule.course_block import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError, NoPathToItem from xmodule.tabs import CourseTabList diff --git a/lms/djangoapps/discussion/django_comment_client/tests/test_models.py b/lms/djangoapps/discussion/django_comment_client/tests/test_models.py index 270f688006bd..098eedf51eda 100644 --- a/lms/djangoapps/discussion/django_comment_client/tests/test_models.py +++ b/lms/djangoapps/discussion/django_comment_client/tests/test_models.py @@ -24,7 +24,7 @@ def setUp(self): super().setUp() # For course ID, syntax edx/classname/classdate is important - # because xmodel.course_module.id_to_location looks for a string to split + # because xmodel.course_block.id_to_location looks for a string to split self.course_id = ToyCourseFactory.create().id self.student_role = models.Role.objects.get_or_create(name="Student", diff --git a/lms/djangoapps/discussion/rest_api/api.py b/lms/djangoapps/discussion/rest_api/api.py index 7c85c93bdd80..6a0b15f1bd72 100644 --- a/lms/djangoapps/discussion/rest_api/api.py +++ b/lms/djangoapps/discussion/rest_api/api.py @@ -75,7 +75,7 @@ ) from openedx.core.djangoapps.user_api.accounts.api import get_account_settings from openedx.core.lib.exceptions import CourseNotFoundError, DiscussionNotFoundError, PageNotFoundError -from xmodule.course_module import CourseBlock +from xmodule.course_block import CourseBlock from xmodule.modulestore.django import modulestore from xmodule.tabs import CourseTabList diff --git a/lms/djangoapps/mobile_api/users/tests.py b/lms/djangoapps/mobile_api/users/tests.py index 237bdea15758..8eb6924bc0d7 100644 --- a/lms/djangoapps/mobile_api/users/tests.py +++ b/lms/djangoapps/mobile_api/users/tests.py @@ -38,7 +38,7 @@ from openedx.core.lib.courses import course_image_url from openedx.features.course_duration_limits.models import CourseDurationLimitConfig from openedx.features.course_experience.tests.views.helpers import add_course_mode -from xmodule.course_module import DEFAULT_START_DATE # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import DEFAULT_START_DATE # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order from .. import errors diff --git a/openedx/core/djangoapps/content/course_overviews/models.py b/openedx/core/djangoapps/content/course_overviews/models.py index d16defff366e..0c0e574ea44b 100644 --- a/openedx/core/djangoapps/content/course_overviews/models.py +++ b/openedx/core/djangoapps/content/course_overviews/models.py @@ -28,7 +28,7 @@ from openedx.core.lib.cache_utils import request_cached, RequestCache from common.djangoapps.static_replace.models import AssetBaseUrlConfig from xmodule import block_metadata_utils, course_metadata_utils # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.course_module import DEFAULT_START_DATE, CourseBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import DEFAULT_START_DATE, CourseBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.tabs import CourseTab # lint-amnesty, pylint: disable=wrong-import-order diff --git a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py index 74b704a3036f..1f3650ff1ec5 100644 --- a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py +++ b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py @@ -28,7 +28,7 @@ from xmodule.contentstore.content import StaticContent # lint-amnesty, pylint: disable=wrong-import-order from xmodule.contentstore.django import contentstore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.course_metadata_utils import DEFAULT_START_DATE # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.course_module import ( # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import ( # lint-amnesty, pylint: disable=wrong-import-order CATALOG_VISIBILITY_ABOUT, CATALOG_VISIBILITY_CATALOG_AND_ABOUT, CATALOG_VISIBILITY_NONE diff --git a/openedx/core/djangoapps/course_live/tab.py b/openedx/core/djangoapps/course_live/tab.py index 0fb97fabcdcf..34bcc8ba1655 100644 --- a/openedx/core/djangoapps/course_live/tab.py +++ b/openedx/core/djangoapps/course_live/tab.py @@ -6,7 +6,7 @@ from common.djangoapps.student.roles import CourseStaffRole, CourseInstructorRole -from xmodule.course_module import CourseBlock +from xmodule.course_block import CourseBlock from xmodule.tabs import TabFragmentViewMixin from lms.djangoapps.courseware.tabs import EnrolledTab from openedx.core.djangoapps.course_live.config.waffle import ENABLE_COURSE_LIVE diff --git a/openedx/core/djangoapps/discussions/utils.py b/openedx/core/djangoapps/discussions/utils.py index 15e5243c1700..7c26a4e482e6 100644 --- a/openedx/core/djangoapps/discussions/utils.py +++ b/openedx/core/djangoapps/discussions/utils.py @@ -13,7 +13,7 @@ from openedx.core.lib.courses import get_course_by_id from xmodule.discussion_block import DiscussionXBlock from openedx.core.types import User -from xmodule.course_module import CourseBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import CourseBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID, Group # lint-amnesty, pylint: disable=wrong-import-order from xmodule.partitions.partitions_service import PartitionService # lint-amnesty, pylint: disable=wrong-import-order diff --git a/openedx/features/lti_course_tab/tab.py b/openedx/features/lti_course_tab/tab.py index 52693a1095ab..924dbe27f798 100644 --- a/openedx/features/lti_course_tab/tab.py +++ b/openedx/features/lti_course_tab/tab.py @@ -19,7 +19,7 @@ from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration from openedx.core.djangolib.markup import HTML from common.djangoapps.student.models import anonymous_id_for_user -from xmodule.course_module import CourseBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_block import CourseBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.tabs import TabFragmentViewMixin, key_checker # lint-amnesty, pylint: disable=wrong-import-order diff --git a/setup.py b/setup.py index 619cfe578a0a..fd2db8a6638e 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ "annotatable = xmodule.annotatable_block:AnnotatableBlock", "chapter = xmodule.seq_module:SectionBlock", "conditional = xmodule.conditional_block:ConditionalBlock", - "course = xmodule.course_module:CourseBlock", + "course = xmodule.course_block:CourseBlock", "course_info = xmodule.html_module:CourseInfoBlock", "customtag = xmodule.template_module:CustomTagBlock", "custom_tag_template = xmodule.template_module:CustomTagTemplateBlock", diff --git a/xmodule/course_module.py b/xmodule/course_block.py similarity index 100% rename from xmodule/course_module.py rename to xmodule/course_block.py diff --git a/xmodule/modulestore/mongo/base.py b/xmodule/modulestore/mongo/base.py index 65ee94753180..de49043e5b16 100644 --- a/xmodule/modulestore/mongo/base.py +++ b/xmodule/modulestore/mongo/base.py @@ -35,7 +35,7 @@ from xblock.runtime import KvsFieldData from xmodule.assetstore import AssetMetadata, CourseAssetsFromStorage -from xmodule.course_module import CourseSummary +from xmodule.course_block import CourseSummary from xmodule.error_module import ErrorBlock from xmodule.errortracker import exc_info_to_str, null_error_tracker from xmodule.exceptions import HeartbeatFailure diff --git a/xmodule/modulestore/split_mongo/split.py b/xmodule/modulestore/split_mongo/split.py index d53e6a0c23ad..5010bf443f0e 100644 --- a/xmodule/modulestore/split_mongo/split.py +++ b/xmodule/modulestore/split_mongo/split.py @@ -79,7 +79,7 @@ from xblock.fields import Reference, ReferenceList, ReferenceValueDict, Scope from xmodule.assetstore import AssetMetadata -from xmodule.course_module import CourseSummary +from xmodule.course_block import CourseSummary from xmodule.error_module import ErrorBlock from xmodule.errortracker import null_error_tracker from xmodule.library_content_module import LibrarySummary diff --git a/xmodule/modulestore/tests/factories.py b/xmodule/modulestore/tests/factories.py index b4e3d5b080a0..9572b0e488f3 100644 --- a/xmodule/modulestore/tests/factories.py +++ b/xmodule/modulestore/tests/factories.py @@ -21,7 +21,7 @@ from opaque_keys.edx.locator import BlockUsageLocator from xblock.core import XBlock -from xmodule.course_module import Textbook +from xmodule.course_block import Textbook from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.mixed import strip_key from xmodule.modulestore.tests.sample_courses import TOY_BLOCK_INFO_TREE, default_block_info_tree diff --git a/xmodule/modulestore/tests/test_semantics.py b/xmodule/modulestore/tests/test_semantics.py index 4c12712d5aaf..a50f19735ba4 100644 --- a/xmodule/modulestore/tests/test_semantics.py +++ b/xmodule/modulestore/tests/test_semantics.py @@ -14,7 +14,7 @@ from xblock.runtime import DictKeyValueStore, KvsFieldData from xblock.test.tools import TestRuntime -from xmodule.course_module import CourseSummary +from xmodule.course_block import CourseSummary from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.draft_and_published import DIRECT_ONLY_CATEGORIES from xmodule.modulestore.exceptions import ItemNotFoundError diff --git a/xmodule/modulestore/tests/test_split_modulestore.py b/xmodule/modulestore/tests/test_split_modulestore.py index 2e0ffcf48106..d9372bb1a894 100644 --- a/xmodule/modulestore/tests/test_split_modulestore.py +++ b/xmodule/modulestore/tests/test_split_modulestore.py @@ -21,7 +21,7 @@ from openedx.core.djangolib.testing.utils import CacheIsolationMixin from openedx.core.lib import tempdir from openedx.core.lib.tests import attr -from xmodule.course_module import CourseBlock +from xmodule.course_block import CourseBlock from xmodule.fields import Date, Timedelta from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.edit_info import EditInfoMixin diff --git a/xmodule/tests/test_course_module.py b/xmodule/tests/test_course_module.py index a8176aaf1131..6db84fcde057 100644 --- a/xmodule/tests/test_course_module.py +++ b/xmodule/tests/test_course_module.py @@ -17,7 +17,7 @@ from xblock.runtime import DictKeyValueStore, KvsFieldData from openedx.core.lib.teams_config import TeamsConfig, DEFAULT_COURSE_RUN_MAX_TEAM_SIZE -import xmodule.course_module +import xmodule.course_block from xmodule.data import CertificatesDisplayBehaviors from xmodule.modulestore.xml import ImportSystem, XMLModuleStore from xmodule.modulestore.exceptions import InvalidProctoringProvider @@ -35,7 +35,7 @@ class CourseFieldsTestCase(unittest.TestCase): def test_default_start_date(self): - assert xmodule.course_module.CourseFields.start.default == datetime(2030, 1, 1, tzinfo=utc) + assert xmodule.course_block.CourseFields.start.default == datetime(2030, 1, 1, tzinfo=utc) class DummySystem(ImportSystem): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring @@ -158,7 +158,7 @@ class CourseSummaryHasEnded(unittest.TestCase): def test_course_end(self): test_course = get_dummy_course("2012-01-01T12:00") bad_end_date = parser.parse("2012-02-21 10:28:45") - summary = xmodule.course_module.CourseSummary(test_course.id, end=bad_end_date) + summary = xmodule.course_block.CourseSummary(test_course.id, end=bad_end_date) assert summary.has_ended() @@ -225,8 +225,8 @@ def test_sorting_score(self, gmtime_mock): ('2012-12-02T12:00', '2011-11-01T12:00', 'Nov 01, 2011', False, 'Nov 01, 2011 at 12:00 UTC'), ('2012-12-02T12:00', 'Spring 2012', 'Spring 2012', False, 'Spring 2012'), ('2012-12-02T12:00', 'November, 2011', 'November, 2011', False, 'November, 2011'), - (xmodule.course_module.CourseFields.start.default, None, 'TBD', True, 'TBD'), - (xmodule.course_module.CourseFields.start.default, 'January 2014', 'January 2014', False, 'January 2014'), + (xmodule.course_block.CourseFields.start.default, None, 'TBD', True, 'TBD'), + (xmodule.course_block.CourseFields.start.default, 'January 2014', 'January 2014', False, 'January 2014'), ] def test_start_date_is_default(self): @@ -492,7 +492,7 @@ def setUp(self): Initialize dummy testing course. """ super().setUp() - self.proctoring_provider = xmodule.course_module.ProctoringProvider() + self.proctoring_provider = xmodule.course_block.ProctoringProvider() def test_from_json_with_platform_default(self): """ @@ -519,7 +519,7 @@ def test_from_json_with_invalid_provider(self, proctored_exams_setting_enabled): throws a ValueError with the correct error message. """ provider = 'invalid-provider' - allowed_proctoring_providers = xmodule.course_module.get_available_providers() + allowed_proctoring_providers = xmodule.course_block.get_available_providers() FEATURES_WITH_PROCTORED_EXAMS = settings.FEATURES.copy() FEATURES_WITH_PROCTORED_EXAMS['ENABLE_PROCTORED_EXAMS'] = proctored_exams_setting_enabled diff --git a/xmodule/tests/test_export.py b/xmodule/tests/test_export.py index 7b0e44f431f5..8e3c83558672 100644 --- a/xmodule/tests/test_export.py +++ b/xmodule/tests/test_export.py @@ -71,7 +71,7 @@ def setUp(self): self.addCleanup(shutil.rmtree, self.temp_dir) @mock.patch('xmodule.video_module.video_module.edxval_api', None) - @mock.patch('xmodule.course_module.requests.get') + @mock.patch('xmodule.course_block.requests.get') @ddt.data( "toy", "simple", diff --git a/xmodule/tests/test_xml_module.py b/xmodule/tests/test_xml_module.py index 09fd7714215d..f36782075f01 100644 --- a/xmodule/tests/test_xml_module.py +++ b/xmodule/tests/test_xml_module.py @@ -11,7 +11,7 @@ from xblock.fields import Any, Boolean, Dict, Float, Integer, List, Scope, String from xblock.runtime import DictKeyValueStore, KvsFieldData -from xmodule.course_module import CourseBlock +from xmodule.course_block import CourseBlock from xmodule.fields import Date, RelativeTime, Timedelta from xmodule.modulestore.inheritance import InheritanceKeyValueStore, InheritanceMixin, InheritingFieldData from xmodule.modulestore.split_mongo.split_mongo_kvs import SplitMongoKVS From 11caff0d2d23da8ae68f19c31c68b5a6285d9417 Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:03:25 +0200 Subject: [PATCH 05/25] refactor: xmodule/editing_module.py -> xmodule/editing_block.py --- xmodule/annotatable_block.py | 2 +- xmodule/capa_block.py | 2 +- xmodule/{editing_module.py => editing_block.py} | 0 xmodule/html_module.py | 2 +- xmodule/lti_module.py | 2 +- xmodule/template_module.py | 2 +- xmodule/video_module/video_module.py | 2 +- xmodule/word_cloud_module.py | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename xmodule/{editing_module.py => editing_block.py} (100%) diff --git a/xmodule/annotatable_block.py b/xmodule/annotatable_block.py index a1634ba66cdc..760fdd724f86 100644 --- a/xmodule/annotatable_block.py +++ b/xmodule/annotatable_block.py @@ -10,7 +10,7 @@ from xblock.fields import Scope, String from openedx.core.djangolib.markup import HTML, Text -from xmodule.editing_module import EditingMixin +from xmodule.editing_block import EditingMixin from xmodule.raw_module import RawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.xml_module import XmlMixin diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py index e2496bf2cedf..c3efb133cba5 100644 --- a/xmodule/capa_block.py +++ b/xmodule/capa_block.py @@ -32,7 +32,7 @@ from xmodule.capa.responsetypes import LoncapaProblemError, ResponseError, StudentInputError from xmodule.capa.util import convert_files_to_filenames, get_inner_html_from_xpath from xmodule.contentstore.django import contentstore -from xmodule.editing_module import EditingMixin +from xmodule.editing_block import EditingMixin from xmodule.exceptions import NotFoundError, ProcessingError from xmodule.graders import ShowCorrectness from xmodule.raw_module import RawMixin diff --git a/xmodule/editing_module.py b/xmodule/editing_block.py similarity index 100% rename from xmodule/editing_module.py rename to xmodule/editing_block.py diff --git a/xmodule/html_module.py b/xmodule/html_module.py index 0dcdffbc41d7..5c2f5244e941 100644 --- a/xmodule/html_module.py +++ b/xmodule/html_module.py @@ -19,7 +19,7 @@ from xblock.fields import Boolean, List, Scope, String from common.djangoapps.xblock_django.constants import ATTR_KEY_ANONYMOUS_USER_ID from xmodule.contentstore.content import StaticContent -from xmodule.editing_module import EditingMixin +from xmodule.editing_block import EditingMixin from xmodule.edxnotes_utils import edxnotes from xmodule.html_checker import check_html from xmodule.stringify import stringify_children diff --git a/xmodule/lti_module.py b/xmodule/lti_module.py index 49e28cd741a4..195b8a4661de 100644 --- a/xmodule/lti_module.py +++ b/xmodule/lti_module.py @@ -77,7 +77,7 @@ from xmodule.mako_module import MakoTemplateBlockBase from openedx.core.djangolib.markup import HTML, Text -from xmodule.editing_module import EditingMixin +from xmodule.editing_block import EditingMixin from common.djangoapps.xblock_django.constants import ( ATTR_KEY_ANONYMOUS_USER_ID, diff --git a/xmodule/template_module.py b/xmodule/template_module.py index 86dbe883f316..692fbea3a4c6 100644 --- a/xmodule/template_module.py +++ b/xmodule/template_module.py @@ -8,7 +8,7 @@ from lxml import etree from pkg_resources import resource_string from web_fragments.fragment import Fragment -from xmodule.editing_module import EditingMixin +from xmodule.editing_block import EditingMixin from xmodule.raw_module import RawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.x_module import ( diff --git a/xmodule/video_module/video_module.py b/xmodule/video_module/video_module.py index df27c2d7f840..fb94a37ba83d 100644 --- a/xmodule/video_module/video_module.py +++ b/xmodule/video_module/video_module.py @@ -35,7 +35,7 @@ from openedx.core.lib.cache_utils import request_cached from openedx.core.lib.license import LicenseMixin from xmodule.contentstore.content import StaticContent -from xmodule.editing_module import EditingMixin +from xmodule.editing_block import EditingMixin from xmodule.exceptions import NotFoundError from xmodule.mako_module import MakoTemplateBlockBase from xmodule.modulestore.inheritance import InheritanceKeyValueStore, own_metadata diff --git a/xmodule/word_cloud_module.py b/xmodule/word_cloud_module.py index 2591772b7a78..dfad29c4e385 100644 --- a/xmodule/word_cloud_module.py +++ b/xmodule/word_cloud_module.py @@ -15,7 +15,7 @@ from web_fragments.fragment import Fragment from xblock.core import XBlock from xblock.fields import Boolean, Dict, Integer, List, Scope, String -from xmodule.editing_module import EditingMixin +from xmodule.editing_block import EditingMixin from xmodule.raw_module import EmptyDataRawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.xml_module import XmlMixin From cf47f6385fef03da27c63ca21f8973da3ecba22d Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:03:54 +0200 Subject: [PATCH 06/25] refactor: xmodule/error_module.py -> xmodule/error_block.py --- cms/djangoapps/contentstore/views/course.py | 2 +- common/djangoapps/student/tests/test_course_listing.py | 2 +- lms/djangoapps/ccx/models.py | 2 +- lms/djangoapps/courseware/access.py | 2 +- lms/djangoapps/courseware/rules.py | 2 +- lms/djangoapps/courseware/tests/tests.py | 2 +- openedx/core/djangoapps/content/course_overviews/models.py | 2 +- .../content/course_overviews/tests/test_course_overviews.py | 2 +- setup.py | 2 +- xmodule/{error_module.py => error_block.py} | 2 +- xmodule/modulestore/inheritance.py | 2 +- xmodule/modulestore/mongo/base.py | 2 +- xmodule/modulestore/split_mongo/caching_descriptor_system.py | 2 +- xmodule/modulestore/split_mongo/split.py | 2 +- xmodule/modulestore/tests/test_xml.py | 2 +- xmodule/modulestore/xml.py | 2 +- xmodule/tests/test_conditional.py | 2 +- xmodule/tests/{test_error_module.py => test_error_block.py} | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) rename xmodule/{error_module.py => error_block.py} (99%) rename xmodule/tests/{test_error_module.py => test_error_block.py} (96%) diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 70ebc6589348..c71197892b1d 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -78,7 +78,7 @@ from openedx.features.course_experience.waffle import ENABLE_COURSE_ABOUT_SIDEBAR_HTML from xmodule.contentstore.content import StaticContent # lint-amnesty, pylint: disable=wrong-import-order from xmodule.course_block import CourseBlock, DEFAULT_START_DATE, CourseFields # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_block import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore import EdxJSONEncoder # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.exceptions import DuplicateCourseError, ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order diff --git a/common/djangoapps/student/tests/test_course_listing.py b/common/djangoapps/student/tests/test_course_listing.py index e93ec5f81747..726de56e9c4f 100644 --- a/common/djangoapps/student/tests/test_course_listing.py +++ b/common/djangoapps/student/tests/test_course_listing.py @@ -17,7 +17,7 @@ from common.djangoapps.student.tests.factories import UserFactory from common.djangoapps.student.views import get_course_enrollments from common.djangoapps.util.milestones_helpers import get_pre_requisite_courses_not_completed, set_prerequisite_courses -from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_block import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order 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 ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order diff --git a/lms/djangoapps/ccx/models.py b/lms/djangoapps/ccx/models.py index 46400b53579e..21f0136f0709 100644 --- a/lms/djangoapps/ccx/models.py +++ b/lms/djangoapps/ccx/models.py @@ -14,7 +14,7 @@ from opaque_keys.edx.django.models import CourseKeyField, UsageKeyField from pytz import utc -from xmodule.error_module import ErrorBlock +from xmodule.error_block import ErrorBlock from xmodule.modulestore.django import modulestore log = logging.getLogger("edx.ccx") diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py index b38a0230d216..0e9b43281c39 100644 --- a/lms/djangoapps/courseware/access.py +++ b/lms/djangoapps/courseware/access.py @@ -62,7 +62,7 @@ is_prerequisite_courses_enabled ) from xmodule.course_block import CATALOG_VISIBILITY_ABOUT, CATALOG_VISIBILITY_CATALOG_AND_ABOUT, CourseBlock # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_block import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.partitions.partitions import NoSuchUserPartitionError, NoSuchUserPartitionGroupError # lint-amnesty, pylint: disable=wrong-import-order log = logging.getLogger(__name__) diff --git a/lms/djangoapps/courseware/rules.py b/lms/djangoapps/courseware/rules.py index 8f4d0de9817e..8202418f6f4c 100644 --- a/lms/djangoapps/courseware/rules.py +++ b/lms/djangoapps/courseware/rules.py @@ -20,7 +20,7 @@ from common.djangoapps.student.models import CourseAccessRole from common.djangoapps.student.roles import CourseRole, OrgRole from xmodule.course_block import CourseBlock # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_block import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order from .access import has_access diff --git a/lms/djangoapps/courseware/tests/tests.py b/lms/djangoapps/courseware/tests/tests.py index 86e5a53bbbf6..c815f7eadba9 100644 --- a/lms/djangoapps/courseware/tests/tests.py +++ b/lms/djangoapps/courseware/tests/tests.py @@ -12,7 +12,7 @@ from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase from lms.djangoapps.lms_xblock.field_data import LmsFieldData -from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_block import ErrorBlock # 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 TEST_DATA_MIXED_MODULESTORE, ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.tests.factories import ToyCourseFactory # lint-amnesty, pylint: disable=wrong-import-order diff --git a/openedx/core/djangoapps/content/course_overviews/models.py b/openedx/core/djangoapps/content/course_overviews/models.py index 0c0e574ea44b..14eb3095a63c 100644 --- a/openedx/core/djangoapps/content/course_overviews/models.py +++ b/openedx/core/djangoapps/content/course_overviews/models.py @@ -29,7 +29,7 @@ from common.djangoapps.static_replace.models import AssetBaseUrlConfig from xmodule import block_metadata_utils, course_metadata_utils # lint-amnesty, pylint: disable=wrong-import-order from xmodule.course_block import DEFAULT_START_DATE, CourseBlock # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_block import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.tabs import CourseTab # lint-amnesty, pylint: disable=wrong-import-order diff --git a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py index 1f3650ff1ec5..ea2ad0753ba0 100644 --- a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py +++ b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py @@ -33,7 +33,7 @@ CATALOG_VISIBILITY_CATALOG_AND_ABOUT, CATALOG_VISIBILITY_NONE ) -from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_block import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order 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 ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order diff --git a/setup.py b/setup.py index fd2db8a6638e..939e5e9df61e 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ "custom_tag_template = xmodule.template_module:CustomTagTemplateBlock", "discuss = xmodule.template_module:TranslateCustomTagBlock", "discussion = xmodule.discussion_block:DiscussionXBlock", - "error = xmodule.error_module:ErrorBlock", + "error = xmodule.error_block:ErrorBlock", "hidden = xmodule.hidden_module:HiddenDescriptor", "html = xmodule.html_module:HtmlBlock", "image = xmodule.template_module:TranslateCustomTagBlock", diff --git a/xmodule/error_module.py b/xmodule/error_block.py similarity index 99% rename from xmodule/error_module.py rename to xmodule/error_block.py index 012e667d3a46..d74cb5930448 100644 --- a/xmodule/error_module.py +++ b/xmodule/error_block.py @@ -113,7 +113,7 @@ def _construct(cls, system, contents, error_msg, location, for_parent=None): }) return system.construct_xblock_from_class( cls, - # The error module doesn't use scoped data, and thus doesn't need + # The error block doesn't use scoped data, and thus doesn't need # real scope keys ScopeIds(None, 'error', location, location), field_data, diff --git a/xmodule/modulestore/inheritance.py b/xmodule/modulestore/inheritance.py index bf05a192ec59..315ce6e509dd 100644 --- a/xmodule/modulestore/inheritance.py +++ b/xmodule/modulestore/inheritance.py @@ -303,7 +303,7 @@ def inherit_metadata(descriptor, inherited_data): """ try: descriptor.xblock_kvs.inherited_settings = inherited_data - except AttributeError: # the kvs doesn't have inherited_settings probably b/c it's an error module + except AttributeError: # the kvs doesn't have inherited_settings probably b/c it's an error block pass diff --git a/xmodule/modulestore/mongo/base.py b/xmodule/modulestore/mongo/base.py index de49043e5b16..e832a60876d2 100644 --- a/xmodule/modulestore/mongo/base.py +++ b/xmodule/modulestore/mongo/base.py @@ -36,7 +36,7 @@ from xmodule.assetstore import AssetMetadata, CourseAssetsFromStorage from xmodule.course_block import CourseSummary -from xmodule.error_module import ErrorBlock +from xmodule.error_block import ErrorBlock from xmodule.errortracker import exc_info_to_str, null_error_tracker from xmodule.exceptions import HeartbeatFailure from xmodule.mako_module import MakoDescriptorSystem diff --git a/xmodule/modulestore/split_mongo/caching_descriptor_system.py b/xmodule/modulestore/split_mongo/caching_descriptor_system.py index f951e5b000cd..b96dee278e2b 100644 --- a/xmodule/modulestore/split_mongo/caching_descriptor_system.py +++ b/xmodule/modulestore/split_mongo/caching_descriptor_system.py @@ -9,7 +9,7 @@ from xblock.fields import ScopeIds from xblock.runtime import KeyValueStore, KvsFieldData -from xmodule.error_module import ErrorBlock +from xmodule.error_block import ErrorBlock from xmodule.errortracker import exc_info_to_str from xmodule.library_tools import LibraryToolsService from xmodule.mako_module import MakoDescriptorSystem diff --git a/xmodule/modulestore/split_mongo/split.py b/xmodule/modulestore/split_mongo/split.py index 5010bf443f0e..14557a9d85ce 100644 --- a/xmodule/modulestore/split_mongo/split.py +++ b/xmodule/modulestore/split_mongo/split.py @@ -80,7 +80,7 @@ from xmodule.assetstore import AssetMetadata from xmodule.course_block import CourseSummary -from xmodule.error_module import ErrorBlock +from xmodule.error_block import ErrorBlock from xmodule.errortracker import null_error_tracker from xmodule.library_content_module import LibrarySummary from xmodule.modulestore import ( diff --git a/xmodule/modulestore/tests/test_xml.py b/xmodule/modulestore/tests/test_xml.py index 9b59cabb46a6..b2c10157fc7b 100644 --- a/xmodule/modulestore/tests/test_xml.py +++ b/xmodule/modulestore/tests/test_xml.py @@ -48,7 +48,7 @@ def test_unicode_chars_in_xml_content(self): with pytest.raises(UnicodeDecodeError): xml.decode('ascii') - # Load the course, but don't make error modules. This will succeed, + # Load the course, but don't make error blocks. This will succeed, # but will record the errors. modulestore = XMLModuleStore( DATA_DIR, diff --git a/xmodule/modulestore/xml.py b/xmodule/modulestore/xml.py index 0830281ba426..c7e74f180c13 100644 --- a/xmodule/modulestore/xml.py +++ b/xmodule/modulestore/xml.py @@ -23,7 +23,7 @@ from xblock.runtime import DictKeyValueStore from common.djangoapps.util.monitoring import monitor_import_failure -from xmodule.error_module import ErrorBlock +from xmodule.error_block import ErrorBlock from xmodule.errortracker import exc_info_to_str, make_error_tracker from xmodule.mako_module import MakoDescriptorSystem from xmodule.modulestore import COURSE_ROOT, LIBRARY_ROOT, ModuleStoreEnum, ModuleStoreReadBase diff --git a/xmodule/tests/test_conditional.py b/xmodule/tests/test_conditional.py index 00abe5f34050..c8a59efb4ec2 100644 --- a/xmodule/tests/test_conditional.py +++ b/xmodule/tests/test_conditional.py @@ -14,7 +14,7 @@ from xblock.fields import ScopeIds from xmodule.conditional_block import ConditionalBlock -from xmodule.error_module import ErrorBlock +from xmodule.error_block import ErrorBlock from xmodule.modulestore.xml import CourseLocationManager, ImportSystem, XMLModuleStore from xmodule.tests import DATA_DIR, get_test_descriptor_system, get_test_system from xmodule.tests.xml import XModuleXmlImportTest diff --git a/xmodule/tests/test_error_module.py b/xmodule/tests/test_error_block.py similarity index 96% rename from xmodule/tests/test_error_module.py rename to xmodule/tests/test_error_block.py index 448152501ecb..5df3bcb61f23 100644 --- a/xmodule/tests/test_error_module.py +++ b/xmodule/tests/test_error_block.py @@ -7,7 +7,7 @@ from opaque_keys.edx.locator import CourseLocator -from xmodule.error_module import ErrorBlock +from xmodule.error_block import ErrorBlock from xmodule.modulestore.xml import CourseLocationManager from xmodule.tests import get_test_system from xmodule.x_module import STUDENT_VIEW From 4d8618517f1031b60f7696b0b2df037cd9f7ff4d Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:04:19 +0200 Subject: [PATCH 07/25] refactor: xmodule/hidden_module.py -> xmodule/hidden_block.py --- cms/envs/bok_choy.auth.json | 4 ++-- cms/envs/bok_choy.yml | 4 ++-- cms/envs/bok_choy_docker.auth.json | 4 ++-- cms/envs/bok_choy_docker.yml | 4 ++-- cms/envs/common.py | 4 ++-- cms/envs/devstack-experimental.yml | 4 ++-- cms/envs/test.py | 2 +- lms/envs/bok_choy.yml | 4 ++-- lms/envs/bok_choy_docker.yml | 4 ++-- lms/envs/common.py | 4 ++-- lms/envs/devstack-experimental.yml | 4 ++-- setup.py | 2 +- xmodule/{hidden_module.py => hidden_block.py} | 0 xmodule/modulestore/tests/django_utils.py | 2 +- xmodule/modulestore/tests/test_mixed_modulestore.py | 2 +- .../modulestore/tests/test_modulestore_settings.py | 12 ++++++------ xmodule/modulestore/tests/test_mongo.py | 2 +- xmodule/modulestore/tests/test_split_modulestore.py | 2 +- xmodule/modulestore/tests/test_split_w_old_mongo.py | 2 +- xmodule/modulestore/tests/utils.py | 2 +- xmodule/modulestore/xml_importer.py | 4 ++-- 21 files changed, 36 insertions(+), 36 deletions(-) rename xmodule/{hidden_module.py => hidden_block.py} (100%) diff --git a/cms/envs/bok_choy.auth.json b/cms/envs/bok_choy.auth.json index 4a9a2f715012..b5b94b7b80a4 100644 --- a/cms/envs/bok_choy.auth.json +++ b/cms/envs/bok_choy.auth.json @@ -72,7 +72,7 @@ "OPTIONS": { "collection": "modulestore", "db": "test", - "default_class": "xmodule.hidden_module.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenDescriptor", "fs_root": "** OVERRIDDEN **", "host": [ "localhost" @@ -86,7 +86,7 @@ "ENGINE": "xmodule.modulestore.xml.XMLModuleStore", "OPTIONS": { "data_dir": "** OVERRIDDEN **", - "default_class": "xmodule.hidden_module.HiddenDescriptor" + "default_class": "xmodule.hidden_block.HiddenDescriptor" } } ] diff --git a/cms/envs/bok_choy.yml b/cms/envs/bok_choy.yml index b378cf6443b5..657bedd74a91 100644 --- a/cms/envs/bok_choy.yml +++ b/cms/envs/bok_choy.yml @@ -105,14 +105,14 @@ MODULESTORE: OPTIONS: collection: modulestore db: test - default_class: xmodule.hidden_module.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenDescriptor fs_root: '** OVERRIDDEN **' host: [localhost] port: 27017 render_template: common.djangoapps.edxmako.shortcuts.render_to_string - ENGINE: xmodule.modulestore.xml.XMLModuleStore NAME: xml - OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_module.HiddenDescriptor} + OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenDescriptor} # We need to test different scenarios, following setting effectively disbale rate limiting PASSWORD_RESET_IP_RATE: '1/s' PASSWORD_RESET_EMAIL_RATE: '1/s' diff --git a/cms/envs/bok_choy_docker.auth.json b/cms/envs/bok_choy_docker.auth.json index 98c999fb7c59..c3e87580eb28 100644 --- a/cms/envs/bok_choy_docker.auth.json +++ b/cms/envs/bok_choy_docker.auth.json @@ -72,7 +72,7 @@ "OPTIONS": { "collection": "modulestore", "db": "test", - "default_class": "xmodule.hidden_module.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenDescriptor", "fs_root": "** OVERRIDDEN **", "host": [ "edx.devstack.mongo" @@ -86,7 +86,7 @@ "ENGINE": "xmodule.modulestore.xml.XMLModuleStore", "OPTIONS": { "data_dir": "** OVERRIDDEN **", - "default_class": "xmodule.hidden_module.HiddenDescriptor" + "default_class": "xmodule.hidden_block.HiddenDescriptor" } } ] diff --git a/cms/envs/bok_choy_docker.yml b/cms/envs/bok_choy_docker.yml index 829b11676659..82b7614ebfc8 100644 --- a/cms/envs/bok_choy_docker.yml +++ b/cms/envs/bok_choy_docker.yml @@ -105,14 +105,14 @@ MODULESTORE: OPTIONS: collection: modulestore db: test - default_class: xmodule.hidden_module.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenDescriptor fs_root: '** OVERRIDDEN **' host: [edx.devstack.mongo] port: 27017 render_template: common.djangoapps.edxmako.shortcuts.render_to_string - ENGINE: xmodule.modulestore.xml.XMLModuleStore NAME: xml - OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_module.HiddenDescriptor} + OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenDescriptor} SECRET_KEY: '' SERVER_EMAIL: devops@example.com SESSION_COOKIE_DOMAIN: null diff --git a/cms/envs/common.py b/cms/envs/common.py index f99dfa0b0bba..bcddb293e0cc 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -1005,7 +1005,7 @@ 'ENGINE': 'xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore', 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': { - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': DATA_DIR, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } @@ -1015,7 +1015,7 @@ 'ENGINE': 'xmodule.modulestore.mongo.DraftMongoModuleStore', 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': { - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': DATA_DIR, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } diff --git a/cms/envs/devstack-experimental.yml b/cms/envs/devstack-experimental.yml index daa1225ee852..cc824e5ef000 100644 --- a/cms/envs/devstack-experimental.yml +++ b/cms/envs/devstack-experimental.yml @@ -379,7 +379,7 @@ MODULESTORE: ENGINE: xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore NAME: split OPTIONS: - default_class: xmodule.hidden_module.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenDescriptor fs_root: /edx/var/edxapp/data render_template: common.djangoapps.edxmako.shortcuts.render_to_string - DOC_STORE_CONFIG: @@ -399,7 +399,7 @@ MODULESTORE: ENGINE: xmodule.modulestore.mongo.DraftMongoModuleStore NAME: draft OPTIONS: - default_class: xmodule.hidden_module.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenDescriptor fs_root: /edx/var/edxapp/data render_template: common.djangoapps.edxmako.shortcuts.render_to_string ORA2_FILE_PREFIX: default_env-default_deployment/ora2 diff --git a/cms/envs/test.py b/cms/envs/test.py index c31635d6bf58..31753437f3ac 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -101,7 +101,7 @@ update_module_store_settings( MODULESTORE, module_store_options={ - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': TEST_ROOT / "data", }, doc_store_settings={ diff --git a/lms/envs/bok_choy.yml b/lms/envs/bok_choy.yml index 7a0eb44f40ae..ca4fb816a306 100644 --- a/lms/envs/bok_choy.yml +++ b/lms/envs/bok_choy.yml @@ -196,14 +196,14 @@ MODULESTORE: OPTIONS: collection: modulestore db: test - default_class: xmodule.hidden_module.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenDescriptor fs_root: '** OVERRIDDEN **' host: [localhost] port: 27017 render_template: common.djangoapps.edxmako.shortcuts.render_to_string - ENGINE: xmodule.modulestore.xml.XMLModuleStore NAME: xml - OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_module.HiddenDescriptor} + OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenDescriptor} # We need to test different scenarios, following setting effectively disbale rate limiting PASSWORD_RESET_IP_RATE: '1/s' PASSWORD_RESET_EMAIL_RATE: '1/s' diff --git a/lms/envs/bok_choy_docker.yml b/lms/envs/bok_choy_docker.yml index 21ccda2df5d3..bff287693985 100644 --- a/lms/envs/bok_choy_docker.yml +++ b/lms/envs/bok_choy_docker.yml @@ -118,14 +118,14 @@ MODULESTORE: OPTIONS: collection: modulestore db: test - default_class: xmodule.hidden_module.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenDescriptor fs_root: '** OVERRIDDEN **' host: [edx.devstack.mongo] port: 27017 render_template: common.djangoapps.edxmako.shortcuts.render_to_string - ENGINE: xmodule.modulestore.xml.XMLModuleStore NAME: xml - OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_module.HiddenDescriptor} + OPTIONS: {data_dir: '** OVERRIDDEN **', default_class: xmodule.hidden_block.HiddenDescriptor} PASSWORD_RESET_SUPPORT_LINK: https://support.example.com/password-reset-help.html REGISTRATION_EXTENSION_FORM: openedx.core.djangoapps.user_api.tests.test_helpers.TestCaseForm REGISTRATION_EXTRA_FIELDS: {city: hidden, country: required, gender: optional, goals: optional, diff --git a/lms/envs/common.py b/lms/envs/common.py index dfc9242319cc..f1259a34d8cb 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1604,7 +1604,7 @@ def _make_mako_template_dirs(settings): 'ENGINE': 'xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore', 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': { - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': DATA_DIR, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } @@ -1614,7 +1614,7 @@ def _make_mako_template_dirs(settings): 'ENGINE': 'xmodule.modulestore.mongo.DraftMongoModuleStore', 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': { - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': DATA_DIR, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } diff --git a/lms/envs/devstack-experimental.yml b/lms/envs/devstack-experimental.yml index 48e641135dac..c0c9afc01fdf 100644 --- a/lms/envs/devstack-experimental.yml +++ b/lms/envs/devstack-experimental.yml @@ -419,7 +419,7 @@ MODULESTORE: ENGINE: xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore NAME: split OPTIONS: - default_class: xmodule.hidden_module.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenDescriptor fs_root: /edx/var/edxapp/data render_template: common.djangoapps.edxmako.shortcuts.render_to_string - DOC_STORE_CONFIG: @@ -439,7 +439,7 @@ MODULESTORE: ENGINE: xmodule.modulestore.mongo.DraftMongoModuleStore NAME: draft OPTIONS: - default_class: xmodule.hidden_module.HiddenDescriptor + default_class: xmodule.hidden_block.HiddenDescriptor fs_root: /edx/var/edxapp/data render_template: common.djangoapps.edxmako.shortcuts.render_to_string OAUTH_DELETE_EXPIRED: true diff --git a/setup.py b/setup.py index 939e5e9df61e..00cf4dc061d1 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ "discuss = xmodule.template_module:TranslateCustomTagBlock", "discussion = xmodule.discussion_block:DiscussionXBlock", "error = xmodule.error_block:ErrorBlock", - "hidden = xmodule.hidden_module:HiddenDescriptor", + "hidden = xmodule.hidden_block:HiddenDescriptor", "html = xmodule.html_module:HtmlBlock", "image = xmodule.template_module:TranslateCustomTagBlock", "library = xmodule.library_root_xblock:LibraryRoot", diff --git a/xmodule/hidden_module.py b/xmodule/hidden_block.py similarity index 100% rename from xmodule/hidden_module.py rename to xmodule/hidden_block.py diff --git a/xmodule/modulestore/tests/django_utils.py b/xmodule/modulestore/tests/django_utils.py index e2f8aa2be6d7..bb0a71762074 100644 --- a/xmodule/modulestore/tests/django_utils.py +++ b/xmodule/modulestore/tests/django_utils.py @@ -76,7 +76,7 @@ def mixed_store_config(data_dir, mappings, store_order=None, modulestore_options store_order = [StoreConstructors.draft, StoreConstructors.split] options = { - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': data_dir, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } diff --git a/xmodule/modulestore/tests/test_mixed_modulestore.py b/xmodule/modulestore/tests/test_mixed_modulestore.py index 07c12949fa96..16417cf29c58 100644 --- a/xmodule/modulestore/tests/test_mixed_modulestore.py +++ b/xmodule/modulestore/tests/test_mixed_modulestore.py @@ -74,7 +74,7 @@ class CommonMixedModuleStoreSetup(CourseComparisonTest): COLLECTION = 'modulestore' ASSET_COLLECTION = 'assetstore' FS_ROOT = DATA_DIR - DEFAULT_CLASS = 'xmodule.hidden_module.HiddenDescriptor' + DEFAULT_CLASS = 'xmodule.hidden_block.HiddenDescriptor' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': '' MONGO_COURSEID = 'MITx/999/2013_Spring' diff --git a/xmodule/modulestore/tests/test_modulestore_settings.py b/xmodule/modulestore/tests/test_modulestore_settings.py index db267b942fb2..b071908ad545 100644 --- a/xmodule/modulestore/tests/test_modulestore_settings.py +++ b/xmodule/modulestore/tests/test_modulestore_settings.py @@ -28,7 +28,7 @@ class ModuleStoreSettingsMigration(TestCase): "ENGINE": "xmodule.modulestore.xml.XMLModuleStore", "OPTIONS": { "data_dir": "directory", - "default_class": "xmodule.hidden_module.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenDescriptor", }, "DOC_STORE_CONFIG": {}, } @@ -40,7 +40,7 @@ class ModuleStoreSettingsMigration(TestCase): "OPTIONS": { "collection": "modulestore", "db": "edxapp", - "default_class": "xmodule.hidden_module.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenDescriptor", "fs_root": mkdtemp_clean(), "host": "localhost", "password": "password", @@ -64,7 +64,7 @@ class ModuleStoreSettingsMigration(TestCase): "OPTIONS": { "collection": "modulestore", "db": "test", - "default_class": "xmodule.hidden_module.HiddenDescriptor", + "default_class": "xmodule.hidden_block.HiddenDescriptor", } }, "default": { @@ -79,7 +79,7 @@ class ModuleStoreSettingsMigration(TestCase): "ENGINE": "xmodule.modulestore.xml.XMLModuleStore", "OPTIONS": { "data_dir": "directory", - "default_class": "xmodule.hidden_module.HiddenDescriptor" + "default_class": "xmodule.hidden_block.HiddenDescriptor" }, "DOC_STORE_CONFIG": {} } @@ -99,7 +99,7 @@ class ModuleStoreSettingsMigration(TestCase): 'ENGINE': 'xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore', 'DOC_STORE_CONFIG': {}, 'OPTIONS': { - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': "fs_root", 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } @@ -109,7 +109,7 @@ class ModuleStoreSettingsMigration(TestCase): 'ENGINE': 'xmodule.modulestore.mongo.draft.DraftModuleStore', 'DOC_STORE_CONFIG': {}, 'OPTIONS': { - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': "fs_root", 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } diff --git a/xmodule/modulestore/tests/test_mongo.py b/xmodule/modulestore/tests/test_mongo.py index c4f61f1b05fe..18cc1c56a491 100644 --- a/xmodule/modulestore/tests/test_mongo.py +++ b/xmodule/modulestore/tests/test_mongo.py @@ -48,7 +48,7 @@ COLLECTION = 'modulestore' ASSET_COLLECTION = 'assetstore' FS_ROOT = DATA_DIR # TODO (vshnayder): will need a real fs_root for testing load_item -DEFAULT_CLASS = 'xmodule.hidden_module.HiddenDescriptor' +DEFAULT_CLASS = 'xmodule.hidden_block.HiddenDescriptor' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': '' diff --git a/xmodule/modulestore/tests/test_split_modulestore.py b/xmodule/modulestore/tests/test_split_modulestore.py index d9372bb1a894..3535abc384c1 100644 --- a/xmodule/modulestore/tests/test_split_modulestore.py +++ b/xmodule/modulestore/tests/test_split_modulestore.py @@ -67,7 +67,7 @@ class SplitModuleTest(unittest.TestCase): 'collection': 'modulestore', } modulestore_options = { - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': tempdir.mkdtemp_clean(), 'xblock_mixins': (InheritanceMixin, XModuleMixin, EditInfoMixin) } diff --git a/xmodule/modulestore/tests/test_split_w_old_mongo.py b/xmodule/modulestore/tests/test_split_w_old_mongo.py index fa55146808f4..d01fefb37766 100644 --- a/xmodule/modulestore/tests/test_split_w_old_mongo.py +++ b/xmodule/modulestore/tests/test_split_w_old_mongo.py @@ -43,7 +43,7 @@ class SplitWMongoCourseBootstrapper(unittest.TestCase): } modulestore_options = { - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', + 'default_class': 'xmodule.hidden_block.HiddenDescriptor', 'fs_root': '', 'render_template': mock.Mock(return_value=""), 'xblock_mixins': (InheritanceMixin, XModuleMixin) diff --git a/xmodule/modulestore/tests/utils.py b/xmodule/modulestore/tests/utils.py index de0edc1727c6..93acc17a227d 100644 --- a/xmodule/modulestore/tests/utils.py +++ b/xmodule/modulestore/tests/utils.py @@ -342,7 +342,7 @@ def build_with_contentstore(self, contentstore=None, course_ids=None, **kwargs): modulestore = XMLModuleStore( DATA_DIR, course_ids=course_ids, - default_class='xmodule.hidden_module.HiddenDescriptor', + default_class='xmodule.hidden_block.HiddenDescriptor', xblock_mixins=XBLOCK_MIXINS, ) diff --git a/xmodule/modulestore/xml_importer.py b/xmodule/modulestore/xml_importer.py index d7824f5edd99..4544a99d96ae 100644 --- a/xmodule/modulestore/xml_importer.py +++ b/xmodule/modulestore/xml_importer.py @@ -260,7 +260,7 @@ class ImportManager: def __init__( self, store, user_id, data_dir, source_dirs=None, - default_class='xmodule.hidden_module.HiddenDescriptor', + default_class='xmodule.hidden_block.HiddenDescriptor', load_error_modules=True, static_content_store=None, target_id=None, verbose=False, do_import_static=True, do_import_python_lib=True, @@ -1229,7 +1229,7 @@ def validate_course_policy(module_store, course_id): def perform_xlint( # lint-amnesty, pylint: disable=missing-function-docstring data_dir, source_dirs, - default_class='xmodule.hidden_module.HiddenDescriptor', + default_class='xmodule.hidden_block.HiddenDescriptor', load_error_modules=True, xblock_mixins=(LocationMixin, XModuleMixin)): err_cnt = 0 From 007e02cd7615b7d2447d026c165819ab339670ff Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:04:42 +0200 Subject: [PATCH 08/25] refactor: xmodule/html_module.py -> xmodule/html_block.py --- .../contentstore/course_info_model.py | 2 +- .../tests/test_backfill_course_outlines.py | 2 +- .../contentstore/tests/test_contentstore.py | 20 +++---- .../contentstore/tests/test_crud.py | 2 +- .../contentstore/tests/test_orphan.py | 2 +- cms/djangoapps/contentstore/tests/utils.py | 14 ++--- .../views/tests/test_course_index.py | 6 +-- .../courseware/tests/test_module_render.py | 2 +- lms/djangoapps/edxnotes/tests.py | 54 +++++++++---------- .../instructor/views/instructor_dashboard.py | 8 +-- .../mobile_api/course_info/tests.py | 2 +- lms/lib/tests/test_utils.py | 12 ++--- lms/lib/xblock/test/test_mixin.py | 12 ++--- .../discussions/tests/test_tasks.py | 4 +- setup.py | 8 +-- xmodule/{html_module.py => html_block.py} | 2 +- xmodule/static_content.py | 2 +- ...test_html_module.py => test_html_block.py} | 14 ++--- xmodule/tests/test_library_content.py | 2 +- xmodule/tests/test_library_root.py | 4 +- xmodule/tests/test_split_test_module.py | 2 +- xmodule/xml_module.py | 2 +- 22 files changed, 89 insertions(+), 89 deletions(-) rename xmodule/{html_module.py => html_block.py} (99%) rename xmodule/tests/{test_html_module.py => test_html_block.py} (96%) diff --git a/cms/djangoapps/contentstore/course_info_model.py b/cms/djangoapps/contentstore/course_info_model.py index 5ecfcb193757..3a9d5d92de42 100644 --- a/cms/djangoapps/contentstore/course_info_model.py +++ b/cms/djangoapps/contentstore/course_info_model.py @@ -20,7 +20,7 @@ from django.utils.translation import gettext as _ from openedx.core.lib.xblock_utils import get_course_update_items -from xmodule.html_module import CourseInfoBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.html_block import CourseInfoBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order diff --git a/cms/djangoapps/contentstore/management/commands/tests/test_backfill_course_outlines.py b/cms/djangoapps/contentstore/management/commands/tests/test_backfill_course_outlines.py index 23a06ced4cc5..fa97328f5866 100644 --- a/cms/djangoapps/contentstore/management/commands/tests/test_backfill_course_outlines.py +++ b/cms/djangoapps/contentstore/management/commands/tests/test_backfill_course_outlines.py @@ -71,7 +71,7 @@ def setUpClass(cls): ItemFactory.create( parent=unit, category="html", - display_name="An HTML Module" + display_name="An HTML Block" ) def test_end_to_end(self): diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 40c9e3a3e324..3bfd30734586 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -283,14 +283,14 @@ def test_rewrite_nonportable_links_on_import(self): # first check a static asset link course_key = self.store.make_course_key('edX', 'toy', 'run') - html_module_location = course_key.make_usage_key('html', 'nonportable') - html_module = self.store.get_item(html_module_location) - self.assertIn('/static/foo.jpg', html_module.data) + html_block_location = course_key.make_usage_key('html', 'nonportable') + html_block = self.store.get_item(html_block_location) + self.assertIn('/static/foo.jpg', html_block.data) # then check a intra courseware link - html_module_location = course_key.make_usage_key('html', 'nonportable_link') - html_module = self.store.get_item(html_module_location) - self.assertIn('/jump_to_id/nonportable_link', html_module.data) + html_block_location = course_key.make_usage_key('html', 'nonportable_link') + html_block = self.store.get_item(html_block_location) + self.assertIn('/jump_to_id/nonportable_link', html_block.data) def verify_content_existence(self, store, root_dir, course_id, dirname, category_name, filename_suffix=''): # lint-amnesty, pylint: disable=missing-function-docstring filesystem = OSFS(root_dir / 'test_export') @@ -525,12 +525,12 @@ def test_html_export_roundtrip(self): import_course_from_xml(self.store, self.user.id, root_dir, create_if_not_present=True) # get the sample HTML with styling information - html_module = self.store.get_item(course_id.make_usage_key('html', 'with_styling')) - self.assertIn('

', html_module.data) + html_block = self.store.get_item(course_id.make_usage_key('html', 'with_styling')) + self.assertIn('

', html_block.data) # get the sample HTML with just a simple tag information - html_module = self.store.get_item(course_id.make_usage_key('html', 'just_img')) - self.assertIn('', html_module.data) + html_block = self.store.get_item(course_id.make_usage_key('html', 'just_img')) + self.assertIn('', html_block.data) def test_export_course_without_content_store(self): # Create toy course diff --git a/cms/djangoapps/contentstore/tests/test_crud.py b/cms/djangoapps/contentstore/tests/test_crud.py index 1cac18bdde00..1ae40b0dfdd6 100644 --- a/cms/djangoapps/contentstore/tests/test_crud.py +++ b/cms/djangoapps/contentstore/tests/test_crud.py @@ -4,7 +4,7 @@ from xmodule import templates from xmodule.capa_block import ProblemBlock from xmodule.course_block import CourseBlock -from xmodule.html_module import HtmlBlock +from xmodule.html_block import HtmlBlock from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.exceptions import DuplicateCourseError from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase diff --git a/cms/djangoapps/contentstore/tests/test_orphan.py b/cms/djangoapps/contentstore/tests/test_orphan.py index c99714d50ef7..5e5ddbabc0d0 100644 --- a/cms/djangoapps/contentstore/tests/test_orphan.py +++ b/cms/djangoapps/contentstore/tests/test_orphan.py @@ -56,7 +56,7 @@ def create_course_with_orphans(self, default_store): orphan_vertical.children.append(multi_parent_html.location) self.store.update_item(orphan_vertical, self.user.id) - # create an orphaned html module + # create an orphaned html block orphan_html = self.store.create_item(self.user.id, course.id, 'html', "OrphanHtml") self.store.publish(orphan_html.location, self.user.id) diff --git a/cms/djangoapps/contentstore/tests/utils.py b/cms/djangoapps/contentstore/tests/utils.py index b2f6356a2abf..cae265f5abc2 100644 --- a/cms/djangoapps/contentstore/tests/utils.py +++ b/cms/djangoapps/contentstore/tests/utils.py @@ -192,15 +192,15 @@ def import_and_populate_course(self): content_store.set_attr(self.LOCKED_ASSET_KEY, 'locked', True) # create a non-portable link - should be rewritten in new courses - html_module = self.store.get_item(course_id.make_usage_key('html', 'nonportable')) - new_data = html_module.data = html_module.data.replace( + html_block = self.store.get_item(course_id.make_usage_key('html', 'nonportable')) + new_data = html_block.data = html_block.data.replace( '/static/', f'/c4x/{course_id.org}/{course_id.course}/asset/' ) - self.store.update_item(html_module, self.user.id) + self.store.update_item(html_block, self.user.id) - html_module = self.store.get_item(html_module.location) - self.assertEqual(new_data, html_module.data) + html_block = self.store.get_item(html_block.location) + self.assertEqual(new_data, html_block.data) return course_id @@ -272,8 +272,8 @@ def get_and_verify_publish_state(item_type, item_name, publish_state): self.assertAssetsEqual(self.LOCKED_ASSET_KEY, self.LOCKED_ASSET_KEY.course_key, course_id) # verify non-portable links are rewritten - html_module = self.store.get_item(course_id.make_usage_key('html', 'nonportable')) - self.assertIn('/static/foo.jpg', html_module.data) + html_block = self.store.get_item(course_id.make_usage_key('html', 'nonportable')) + self.assertIn('/static/foo.jpg', html_block.data) return course diff --git a/cms/djangoapps/contentstore/views/tests/test_course_index.py b/cms/djangoapps/contentstore/views/tests/test_course_index.py index 04b66498b01d..e05b500a7d16 100644 --- a/cms/djangoapps/contentstore/views/tests/test_course_index.py +++ b/cms/djangoapps/contentstore/views/tests/test_course_index.py @@ -728,7 +728,7 @@ def test_empty_content_type(self): self.assertContains(response, self.SUCCESSFUL_RESPONSE) self.assertEqual(response.status_code, 200) - @mock.patch('xmodule.html_module.HtmlBlock.index_dictionary') + @mock.patch('xmodule.html_block.HtmlBlock.index_dictionary') def test_reindex_course_search_index_error(self, mock_index_dictionary): """ Test json response with mocked error data for html @@ -791,7 +791,7 @@ def test_reindex_video_error_json_responses(self, mock_index_dictionary): with self.assertRaises(SearchIndexingError): reindex_course_and_check_access(self.course.id, self.user) - @mock.patch('xmodule.html_module.HtmlBlock.index_dictionary') + @mock.patch('xmodule.html_block.HtmlBlock.index_dictionary') def test_reindex_html_error_json_responses(self, mock_index_dictionary): """ Test json response with mocked error data for html @@ -901,7 +901,7 @@ def test_indexing_video_error_responses(self, mock_index_dictionary): with self.assertRaises(SearchIndexingError): CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id) - @mock.patch('xmodule.html_module.HtmlBlock.index_dictionary') + @mock.patch('xmodule.html_block.HtmlBlock.index_dictionary') def test_indexing_html_error_responses(self, mock_index_dictionary): """ Test do_course_reindex response with mocked error data for html diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index a338a5e74a0f..bc10fa8e3908 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -44,7 +44,7 @@ from xmodule.capa.xqueue_interface import XQueueInterface from xmodule.capa_block import ProblemBlock from xmodule.contentstore.django import contentstore -from xmodule.html_module import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock +from xmodule.html_block import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock from xmodule.lti_module import LTIBlock from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import ModuleI18nService, modulestore diff --git a/lms/djangoapps/edxnotes/tests.py b/lms/djangoapps/edxnotes/tests.py index 2e6918c75cd7..0f7e8a899676 100644 --- a/lms/djangoapps/edxnotes/tests.py +++ b/lms/djangoapps/edxnotes/tests.py @@ -209,15 +209,15 @@ def setUp(self): self.chapter_2 = ItemFactory.create(category="chapter", parent_location=self.course.location) self.sequential = ItemFactory.create(category="sequential", parent_location=self.chapter.location) self.vertical = ItemFactory.create(category="vertical", parent_location=self.sequential.location) - self.html_module_1 = ItemFactory.create(category="html", parent_location=self.vertical.location) - self.html_module_2 = ItemFactory.create(category="html", parent_location=self.vertical.location) + self.html_block_1 = ItemFactory.create(category="html", parent_location=self.vertical.location) + self.html_block_2 = ItemFactory.create(category="html", parent_location=self.vertical.location) self.vertical_with_container = ItemFactory.create( category='vertical', parent_location=self.sequential.location ) self.child_container = ItemFactory.create( category='split_test', parent_location=self.vertical_with_container.location) self.child_vertical = ItemFactory.create(category='vertical', parent_location=self.child_container.location) - self.child_html_module = ItemFactory.create(category="html", parent_location=self.child_vertical.location) + self.child_html_block = ItemFactory.create(category="html", parent_location=self.child_vertical.location) # Read again so that children lists are accurate self.course = self.store.get_item(self.course.location) @@ -229,7 +229,7 @@ def setUp(self): self.vertical_with_container = self.store.get_item(self.vertical_with_container.location) self.child_container = self.store.get_item(self.child_container.location) self.child_vertical = self.store.get_item(self.child_vertical.location) - self.child_html_module = self.store.get_item(self.child_html_module.location) + self.child_html_block = self.store.get_item(self.child_html_block.location) self.user = UserFactory() self.client.login(username=self.user.username, password=UserFactory._DEFAULT_PASSWORD) # lint-amnesty, pylint: disable=protected-access @@ -320,13 +320,13 @@ def test_get_notes_correct_data(self, mock_get): { "quote": "quote text", "text": "text", - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": datetime(2014, 11, 19, 8, 5, 16, 00000).isoformat(), }, { "quote": "quote text", "text": "text", - "usage_id": str(self.html_module_2.location), + "usage_id": str(self.html_block_2.location), "updated": datetime(2014, 11, 19, 8, 6, 16, 00000).isoformat(), } ] @@ -363,7 +363,7 @@ def test_get_notes_correct_data(self, mock_get): "display_name": self.vertical.display_name_with_default, "location": str(self.vertical.location), }, - "usage_id": str(self.html_module_2.location), + "usage_id": str(self.html_block_2.location), "updated": "Nov 19, 2014 at 08:06 UTC", }, { @@ -387,7 +387,7 @@ def test_get_notes_correct_data(self, mock_get): "display_name": self.vertical.display_name_with_default, "location": str(self.vertical.location), }, - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": "Nov 19, 2014 at 08:05 UTC", }, ] @@ -425,13 +425,13 @@ def test_search_correct_data(self, mock_get): { "quote": "quote text", "text": "text", - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": datetime(2014, 11, 19, 8, 5, 16, 00000).isoformat(), }, { "quote": "quote text", "text": "text", - "usage_id": str(self.html_module_2.location), + "usage_id": str(self.html_block_2.location), "updated": datetime(2014, 11, 19, 8, 6, 16, 00000).isoformat(), } ] @@ -467,7 +467,7 @@ def test_search_correct_data(self, mock_get): "display_name": self.vertical.display_name_with_default, "location": str(self.vertical.location), }, - "usage_id": str(self.html_module_2.location), + "usage_id": str(self.html_block_2.location), "updated": "Nov 19, 2014 at 08:06 UTC", }, { @@ -491,7 +491,7 @@ def test_search_correct_data(self, mock_get): "display_name": self.vertical.display_name_with_default, "location": str(self.vertical.location), }, - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": "Nov 19, 2014 at 08:05 UTC", }, ] @@ -552,7 +552,7 @@ def test_preprocess_collection_no_item(self): { "quote": "quote text", "text": "text", - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": datetime(2014, 11, 19, 8, 5, 16, 00000).isoformat() }, { @@ -583,7 +583,7 @@ def test_preprocess_collection_no_item(self): "display_name": self.vertical.display_name_with_default, "location": str(self.vertical.location), }, - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": datetime(2014, 11, 19, 8, 5, 16, 00000), }]) == len(helpers.preprocess_collection(self.user, self.course, initial_collection)) @@ -595,18 +595,18 @@ def test_preprocess_collection_has_access(self): { "quote": "quote text", "text": "text", - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": datetime(2014, 11, 19, 8, 5, 16, 00000).isoformat(), }, { "quote": "quote text", "text": "text", - "usage_id": str(self.html_module_2.location), + "usage_id": str(self.html_block_2.location), "updated": datetime(2014, 11, 19, 8, 6, 16, 00000).isoformat(), }, ] - self.html_module_2.visible_to_staff_only = True - self.store.update_item(self.html_module_2, self.user.id) + self.html_block_2.visible_to_staff_only = True + self.store.update_item(self.html_block_2, self.user.id) assert len( [{ "quote": "quote text", @@ -627,7 +627,7 @@ def test_preprocess_collection_has_access(self): "display_name": self.vertical.display_name_with_default, "location": str(self.vertical.location), }, - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": datetime(2014, 11, 19, 8, 5, 16, 00000), }]) == len(helpers.preprocess_collection(self.user, self.course, initial_collection)) @@ -644,7 +644,7 @@ def test_preprocess_collection_no_unit(self, mock_modulestore, mock_has_access): initial_collection = [{ "quote": "quote text", "text": "text", - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": datetime(2014, 11, 19, 8, 5, 16, 00000).isoformat(), }] @@ -659,13 +659,13 @@ def test_preprocess_collection_with_disabled_tabs(self, ): { "quote": "quote text1", "text": "text1", - "usage_id": str(self.html_module_1.location), + "usage_id": str(self.html_block_1.location), "updated": datetime(2016, 1, 26, 8, 5, 16, 00000).isoformat(), }, { "quote": "quote text2", "text": "text2", - "usage_id": str(self.html_module_2.location), + "usage_id": str(self.html_block_2.location), "updated": datetime(2016, 1, 26, 9, 6, 17, 00000).isoformat(), }, ] @@ -683,7 +683,7 @@ def test_preprocess_collection_with_disabled_tabs(self, ): }, 'text': 'text1', 'quote': 'quote text1', - 'usage_id': str(self.html_module_1.location), + 'usage_id': str(self.html_block_1.location), 'updated': datetime(2016, 1, 26, 8, 5, 16) }, { @@ -696,7 +696,7 @@ def test_preprocess_collection_with_disabled_tabs(self, ): }, 'text': 'text2', 'quote': 'quote text2', - 'usage_id': str(self.html_module_2.location), + 'usage_id': str(self.html_block_2.location), 'updated': datetime(2016, 1, 26, 9, 6, 17) } ]) == len(helpers.preprocess_collection(self.user, self.course, initial_collection)) @@ -720,10 +720,10 @@ def test_get_module_context_html_component(self): """ self.assertDictEqual( { - "display_name": self.html_module_1.display_name_with_default, - "location": str(self.html_module_1.location), + "display_name": self.html_block_1.display_name_with_default, + "location": str(self.html_block_1.location), }, - helpers.get_module_context(self.course, self.html_module_1) + helpers.get_module_context(self.course, self.html_block_1) ) def test_get_module_context_chapter(self): diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index 4d52d7aaf4e7..7896bee18e28 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -64,7 +64,7 @@ from openedx.core.lib.courses import get_course_by_id from openedx.core.lib.url_utils import quote_slashes from openedx.core.lib.xblock_utils import wrap_xblock -from xmodule.html_module import HtmlBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.html_block import HtmlBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.tabs import CourseTab # lint-amnesty, pylint: disable=wrong-import-order @@ -661,14 +661,14 @@ def _section_send_email(course, access): # Monkey-patch applicable_aside_types to return no asides for the duration of this render with patch.object(course.runtime, 'applicable_aside_types', null_applicable_aside_types): # This HtmlBlock is only being used to generate a nice text editor. - html_module = HtmlBlock( + html_block = HtmlBlock( course.system, DictFieldData({'data': ''}), ScopeIds(None, None, None, course_key.make_usage_key('html', 'fake')) ) - fragment = course.system.render(html_module, 'studio_view') + fragment = course.system.render(html_block, 'studio_view') fragment = wrap_xblock( - 'LmsRuntime', html_module, 'studio_view', fragment, None, + 'LmsRuntime', html_block, 'studio_view', fragment, None, extra_data={"course-id": str(course_key)}, usage_id_serializer=lambda usage_id: quote_slashes(str(usage_id)), # Generate a new request_token here at random, because this module isn't connected to any other diff --git a/lms/djangoapps/mobile_api/course_info/tests.py b/lms/djangoapps/mobile_api/course_info/tests.py index 0d6156b5a062..086359cafb8f 100644 --- a/lms/djangoapps/mobile_api/course_info/tests.py +++ b/lms/djangoapps/mobile_api/course_info/tests.py @@ -16,7 +16,7 @@ from lms.djangoapps.mobile_api.testutils import MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTestMixin from lms.djangoapps.mobile_api.utils import API_V1, API_V05 from openedx.features.course_experience import ENABLE_COURSE_GOALS -from xmodule.html_module import CourseInfoBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.html_block import CourseInfoBlock # lint-amnesty, pylint: disable=wrong-import-order 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 diff --git a/lms/lib/tests/test_utils.py b/lms/lib/tests/test_utils.py index 15bd6efe9880..eb8e76e9c0cc 100644 --- a/lms/lib/tests/test_utils.py +++ b/lms/lib/tests/test_utils.py @@ -23,14 +23,14 @@ def setUp(self): self.chapter = ItemFactory.create(category="chapter", parent_location=self.course.location) self.sequential = ItemFactory.create(category="sequential", parent_location=self.chapter.location) self.vertical = ItemFactory.create(category="vertical", parent_location=self.sequential.location) - self.html_module_1 = ItemFactory.create(category="html", parent_location=self.vertical.location) + self.html_block_1 = ItemFactory.create(category="html", parent_location=self.vertical.location) self.vertical_with_container = ItemFactory.create( category="vertical", parent_location=self.sequential.location ) self.child_container = ItemFactory.create( category="split_test", parent_location=self.vertical_with_container.location) self.child_vertical = ItemFactory.create(category="vertical", parent_location=self.child_container.location) - self.child_html_module = ItemFactory.create(category="html", parent_location=self.child_vertical.location) + self.child_html_block = ItemFactory.create(category="html", parent_location=self.child_vertical.location) # Read again so that children lists are accurate self.course = self.store.get_item(self.course.location) @@ -41,16 +41,16 @@ def setUp(self): self.vertical_with_container = self.store.get_item(self.vertical_with_container.location) self.child_container = self.store.get_item(self.child_container.location) self.child_vertical = self.store.get_item(self.child_vertical.location) - self.child_html_module = self.store.get_item(self.child_html_module.location) + self.child_html_block = self.store.get_item(self.child_html_block.location) def test_get_parent_unit(self): """ Tests `get_parent_unit` method for the successful result. """ - parent = utils.get_parent_unit(self.html_module_1) + parent = utils.get_parent_unit(self.html_block_1) assert parent.location == self.vertical.location - parent = utils.get_parent_unit(self.child_html_module) + parent = utils.get_parent_unit(self.child_html_block) assert parent.location == self.vertical_with_container.location assert utils.get_parent_unit(None) is None @@ -63,6 +63,6 @@ def test_is_unit(self): """ Tests `is_unit` method for the successful result. """ - assert not utils.is_unit(self.html_module_1) + assert not utils.is_unit(self.html_block_1) assert not utils.is_unit(self.child_vertical) assert utils.is_unit(self.vertical) diff --git a/lms/lib/xblock/test/test_mixin.py b/lms/lib/xblock/test/test_mixin.py index 3d64f559a26a..165167a36db0 100644 --- a/lms/lib/xblock/test/test_mixin.py +++ b/lms/lib/xblock/test/test_mixin.py @@ -47,14 +47,14 @@ def build_course(self): video = ItemFactory.create(parent=vertical, category='video', display_name='Test Video 1') split_test = ItemFactory.create(parent=vertical, category='split_test', display_name='Test Content Experiment') child_vertical = ItemFactory.create(parent=split_test, category='vertical') - child_html_module = ItemFactory.create(parent=child_vertical, category='html') + child_html_block = ItemFactory.create(parent=child_vertical, category='html') self.section_location = section.location self.subsection_location = subsection.location self.vertical_location = vertical.location self.video_location = video.location self.split_test_location = split_test.location self.child_vertical_location = child_vertical.location - self.child_html_module_location = child_html_module.location + self.child_html_block_location = child_html_block.location def set_group_access(self, block_location, access_dict): """ @@ -180,14 +180,14 @@ def test_validate_nonsensical_access_for_split_test_children(self): self.set_group_access(self.vertical_location, {self.user_partition.id: [self.group1.id]}) self.set_group_access(self.split_test_location, {self.user_partition.id: [self.group2.id]}) self.set_group_access(self.child_vertical_location, {self.user_partition.id: [self.group2.id]}) - self.set_group_access(self.child_html_module_location, {self.user_partition.id: [self.group2.id]}) - validation = self.store.get_item(self.child_html_module_location).validate() + self.set_group_access(self.child_html_block_location, {self.user_partition.id: [self.group2.id]}) + validation = self.store.get_item(self.child_html_block_location).validate() assert len(validation.messages) == 0 # Test that a validation message is displayed on split_test child when the child contradicts the parent, # even though the child agrees with the grandparent unit. - self.set_group_access(self.child_html_module_location, {self.user_partition.id: [self.group1.id]}) - validation = self.store.get_item(self.child_html_module_location).validate() + self.set_group_access(self.child_html_block_location, {self.user_partition.id: [self.group1.id]}) + validation = self.store.get_item(self.child_html_block_location).validate() assert len(validation.messages) == 1 self.verify_validation_message( validation.messages[0], diff --git a/openedx/core/djangoapps/discussions/tests/test_tasks.py b/openedx/core/djangoapps/discussions/tests/test_tasks.py index 097fe971e959..47020d659e8d 100644 --- a/openedx/core/djangoapps/discussions/tests/test_tasks.py +++ b/openedx/core/djangoapps/discussions/tests/test_tasks.py @@ -84,7 +84,7 @@ def setUp(self): display_name="Non-Discussable Unit", discussion_enabled=False, ) - ItemFactory.create(parent=self.unit, category="html", display_name="An HTML Module") + ItemFactory.create(parent=self.unit, category="html", display_name="An HTML Block") graded_sequence = ItemFactory.create( parent=self.section, category="sequential", @@ -111,7 +111,7 @@ def setUp(self): ItemFactory.create( parent=graded_unit, category="html", - display_name="Graded HTML Module", + display_name="Graded HTML Block", ) discussion_config = DiscussionsConfiguration.get(course_key) discussion_config.provider_type = Provider.OPEN_EDX diff --git a/setup.py b/setup.py index 00cf4dc061d1..6bc1594aceb1 100644 --- a/setup.py +++ b/setup.py @@ -5,20 +5,20 @@ from setuptools import setup XBLOCKS = [ - "about = xmodule.html_module:AboutBlock", + "about = xmodule.html_block:AboutBlock", "book = xmodule.template_module:TranslateCustomTagBlock", "annotatable = xmodule.annotatable_block:AnnotatableBlock", "chapter = xmodule.seq_module:SectionBlock", "conditional = xmodule.conditional_block:ConditionalBlock", "course = xmodule.course_block:CourseBlock", - "course_info = xmodule.html_module:CourseInfoBlock", + "course_info = xmodule.html_block:CourseInfoBlock", "customtag = xmodule.template_module:CustomTagBlock", "custom_tag_template = xmodule.template_module:CustomTagTemplateBlock", "discuss = xmodule.template_module:TranslateCustomTagBlock", "discussion = xmodule.discussion_block:DiscussionXBlock", "error = xmodule.error_block:ErrorBlock", "hidden = xmodule.hidden_block:HiddenDescriptor", - "html = xmodule.html_module:HtmlBlock", + "html = xmodule.html_block:HtmlBlock", "image = xmodule.template_module:TranslateCustomTagBlock", "library = xmodule.library_root_xblock:LibraryRoot", "library_content = xmodule.library_content_module:LibraryContentBlock", @@ -30,7 +30,7 @@ "sequential = xmodule.seq_module:SequenceBlock", "slides = xmodule.template_module:TranslateCustomTagBlock", "split_test = xmodule.split_test_module:SplitTestBlock", - "static_tab = xmodule.html_module:StaticTabBlock", + "static_tab = xmodule.html_block:StaticTabBlock", "unit = xmodule.unit_block:UnitBlock", "vertical = xmodule.vertical_block:VerticalBlock", "video = xmodule.video_module:VideoBlock", diff --git a/xmodule/html_module.py b/xmodule/html_block.py similarity index 99% rename from xmodule/html_module.py rename to xmodule/html_block.py index 5c2f5244e941..5913312a4474 100644 --- a/xmodule/html_module.py +++ b/xmodule/html_block.py @@ -210,7 +210,7 @@ def get_context(self): add in a base path to our c4x content addressing scheme """ _context = EditingMixin.get_context(self) - # Add some specific HTML rendering context when editing HTML modules where we pass + # Add some specific HTML rendering context when editing HTML blocks where we pass # the root /c4x/ url for assets. This allows client-side substitutions to occur. _context.update({ 'base_asset_url': StaticContent.get_base_url_path_for_course_assets(self.location.course_key), diff --git a/xmodule/static_content.py b/xmodule/static_content.py index 0aee38db3a08..0fd00dfe1ace 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -22,7 +22,7 @@ from xmodule.annotatable_block import AnnotatableBlock from xmodule.capa_block import ProblemBlock from xmodule.conditional_block import ConditionalBlock -from xmodule.html_module import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock +from xmodule.html_block import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock from xmodule.library_content_module import LibraryContentBlock from xmodule.lti_module import LTIBlock from xmodule.poll_module import PollBlock diff --git a/xmodule/tests/test_html_module.py b/xmodule/tests/test_html_block.py similarity index 96% rename from xmodule/tests/test_html_module.py rename to xmodule/tests/test_html_block.py index 13fa83d268f9..50968e54d7ae 100644 --- a/xmodule/tests/test_html_module.py +++ b/xmodule/tests/test_html_block.py @@ -10,7 +10,7 @@ from xblock.field_data import DictFieldData from xblock.fields import ScopeIds -from xmodule.html_module import CourseInfoBlock, HtmlBlock +from xmodule.html_block import CourseInfoBlock, HtmlBlock from ..x_module import PUBLIC_VIEW, STUDENT_VIEW from . import get_test_descriptor_system, get_test_system @@ -146,7 +146,7 @@ class HtmlBlockIndexingTestCase(unittest.TestCase): Make sure that HtmlBlock can format data for indexing as expected. """ - def test_index_dictionary_simple_html_module(self): + def test_index_dictionary_simple_html_block(self): sample_xml = '''

Hello World!

@@ -156,7 +156,7 @@ def test_index_dictionary_simple_html_module(self): assert descriptor.index_dictionary() ==\ {'content': {'html_content': ' Hello World! ', 'display_name': 'Text'}, 'content_type': 'Text'} - def test_index_dictionary_cdata_html_module(self): + def test_index_dictionary_cdata_html_block(self): sample_xml_cdata = '''

This has CDATA in it.

@@ -167,7 +167,7 @@ def test_index_dictionary_cdata_html_module(self): assert descriptor.index_dictionary() ==\ {'content': {'html_content': ' This has CDATA in it. ', 'display_name': 'Text'}, 'content_type': 'Text'} - def test_index_dictionary_multiple_spaces_html_module(self): + def test_index_dictionary_multiple_spaces_html_block(self): sample_xml_tab_spaces = '''

Text has spaces :)

@@ -177,7 +177,7 @@ def test_index_dictionary_multiple_spaces_html_module(self): assert descriptor.index_dictionary() ==\ {'content': {'html_content': ' Text has spaces :) ', 'display_name': 'Text'}, 'content_type': 'Text'} - def test_index_dictionary_html_module_with_comment(self): + def test_index_dictionary_html_block_with_comment(self): sample_xml_comment = '''

This has HTML comment in it.

@@ -187,7 +187,7 @@ def test_index_dictionary_html_module_with_comment(self): descriptor = instantiate_descriptor(data=sample_xml_comment) assert descriptor.index_dictionary() == {'content': {'html_content': ' This has HTML comment in it. ', 'display_name': 'Text'}, 'content_type': 'Text'} # pylint: disable=line-too-long - def test_index_dictionary_html_module_with_both_comments_and_cdata(self): + def test_index_dictionary_html_block_with_both_comments_and_cdata(self): sample_xml_mix_comment_cdata = ''' @@ -202,7 +202,7 @@ def test_index_dictionary_html_module_with_both_comments_and_cdata(self): {'content': {'html_content': ' This has HTML comment in it. HTML end. ', 'display_name': 'Text'}, 'content_type': 'Text'} - def test_index_dictionary_html_module_with_script_and_style_tags(self): + def test_index_dictionary_html_block_with_script_and_style_tags(self): sample_xml_style_script_tags = ''' diff --git a/xmodule/tests/test_library_content.py b/xmodule/tests/test_library_content.py index 9fdcc494efc2..2a7d3954a9d9 100644 --- a/xmodule/tests/test_library_content.py +++ b/xmodule/tests/test_library_content.py @@ -463,7 +463,7 @@ def setUp(self): @patch( 'xmodule.modulestore.split_mongo.caching_descriptor_system.CachingDescriptorSystem.render', VanillaRuntime.render ) -@patch('xmodule.html_module.HtmlBlock.author_view', dummy_render, create=True) +@patch('xmodule.html_block.HtmlBlock.author_view', dummy_render, create=True) @patch('xmodule.x_module.DescriptorSystem.applicable_aside_types', lambda self, block: []) class TestLibraryContentRender(LibraryContentTest): """ diff --git a/xmodule/tests/test_library_root.py b/xmodule/tests/test_library_root.py index c1eaded51cd2..0d194d11690c 100644 --- a/xmodule/tests/test_library_root.py +++ b/xmodule/tests/test_library_root.py @@ -17,8 +17,8 @@ @patch( 'xmodule.modulestore.split_mongo.caching_descriptor_system.CachingDescriptorSystem.render', VanillaRuntime.render ) -@patch('xmodule.html_module.HtmlBlock.author_view', dummy_render, create=True) -@patch('xmodule.html_module.HtmlBlock.has_author_view', True, create=True) +@patch('xmodule.html_block.HtmlBlock.author_view', dummy_render, create=True) +@patch('xmodule.html_block.HtmlBlock.has_author_view', True, create=True) @patch('xmodule.x_module.DescriptorSystem.applicable_aside_types', lambda self, block: []) class TestLibraryRoot(MixedSplitTestCase): """ diff --git a/xmodule/tests/test_split_test_module.py b/xmodule/tests/test_split_test_module.py index 9ae349f4fb16..212dfa87b585 100644 --- a/xmodule/tests/test_split_test_module.py +++ b/xmodule/tests/test_split_test_module.py @@ -167,7 +167,7 @@ def test_child_persist_new_tag_value_when_tag_missing(self, _user_tag): assert self.split_test_module.child_descriptor.url_name == self.split_test_module.child_descriptor.url_name # Patch the definition_to_xml for the html children. - @patch('xmodule.html_module.HtmlBlock.definition_to_xml') + @patch('xmodule.html_block.HtmlBlock.definition_to_xml') def test_export_import_round_trip(self, def_to_xml): # The HtmlBlock definition_to_xml tries to write to the filesystem # before returning an xml object. Patch this to just return the xml. diff --git a/xmodule/xml_module.py b/xmodule/xml_module.py index 94b90d89c463..8eb3b3ebf23f 100644 --- a/xmodule/xml_module.py +++ b/xmodule/xml_module.py @@ -202,7 +202,7 @@ def load_definition(cls, xml_object, system, def_id, id_generator): """ Load a descriptor definition from the specified xml_object. Subclasses should not need to override this except in special - cases (e.g. html module) + cases (e.g. html block) Args: xml_object: an lxml.etree._Element containing the definition to load From e3591701e3a7d62ec08a857943687589873cd32a Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:05:32 +0200 Subject: [PATCH 09/25] refactor: xmodule/library_content_module.py -> xmodule/library_content_block.py --- lms/djangoapps/course_blocks/transformers/library_content.py | 2 +- setup.py | 2 +- .../{library_content_module.py => library_content_block.py} | 4 ++-- xmodule/library_tools.py | 2 +- xmodule/modulestore/split_mongo/split.py | 2 +- xmodule/static_content.py | 2 +- xmodule/tests/test_library_content.py | 2 +- xmodule/tests/test_randomize_module.py | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) rename xmodule/{library_content_module.py => library_content_block.py} (99%) diff --git a/lms/djangoapps/course_blocks/transformers/library_content.py b/lms/djangoapps/course_blocks/transformers/library_content.py index 7a9dbddc4660..ae4ad7b2282a 100644 --- a/lms/djangoapps/course_blocks/transformers/library_content.py +++ b/lms/djangoapps/course_blocks/transformers/library_content.py @@ -14,7 +14,7 @@ BlockStructureTransformer, FilteringTransformerMixin ) -from xmodule.library_content_module import LibraryContentBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.library_content_block import LibraryContentBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from ..utils import get_student_module_as_dict diff --git a/setup.py b/setup.py index 6bc1594aceb1..168cac610c79 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ "html = xmodule.html_block:HtmlBlock", "image = xmodule.template_module:TranslateCustomTagBlock", "library = xmodule.library_root_xblock:LibraryRoot", - "library_content = xmodule.library_content_module:LibraryContentBlock", + "library_content = xmodule.library_content_block:LibraryContentBlock", "library_sourced = xmodule.library_sourced_block:LibrarySourcedBlock", "lti = xmodule.lti_module:LTIBlock", "poll_question = xmodule.poll_module:PollBlock", diff --git a/xmodule/library_content_module.py b/xmodule/library_content_block.py similarity index 99% rename from xmodule/library_content_module.py rename to xmodule/library_content_block.py index 0d9d4e080f10..81b961c688ce 100644 --- a/xmodule/library_content_module.py +++ b/xmodule/library_content_block.py @@ -591,7 +591,7 @@ def _set_validation_error_if_empty(self, validation, summary): def validate(self): """ - Validates the state of this Library Content Module Instance. This + Validates the state of this Library Content Block Instance. This is the override of the general XBlock method, and it will also ask its superclass to validate. """ @@ -733,7 +733,7 @@ def definition_from_xml(cls, xml_object, system): return definition, children def definition_to_xml(self, resource_fs): - """ Exports Library Content Module to XML """ + """ Exports Library Content Block to XML """ xml_object = etree.Element('library_content') for child in self.get_children(): self.runtime.add_block_as_child_node(child, xml_object) diff --git a/xmodule/library_tools.py b/xmodule/library_tools.py index c0bfd48d4b29..5b59cc210d11 100644 --- a/xmodule/library_tools.py +++ b/xmodule/library_tools.py @@ -15,7 +15,7 @@ from openedx.core.lib import blockstore_api from common.djangoapps.student.auth import has_studio_write_access from xmodule.capa_block import ProblemBlock -from xmodule.library_content_module import ANY_CAPA_TYPE_VALUE +from xmodule.library_content_block import ANY_CAPA_TYPE_VALUE from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.exceptions import ItemNotFoundError diff --git a/xmodule/modulestore/split_mongo/split.py b/xmodule/modulestore/split_mongo/split.py index 14557a9d85ce..58e6af9816bd 100644 --- a/xmodule/modulestore/split_mongo/split.py +++ b/xmodule/modulestore/split_mongo/split.py @@ -82,7 +82,7 @@ from xmodule.course_block import CourseSummary from xmodule.error_block import ErrorBlock from xmodule.errortracker import null_error_tracker -from xmodule.library_content_module import LibrarySummary +from xmodule.library_content_block import LibrarySummary from xmodule.modulestore import ( BlockData, BulkOperationsMixin, diff --git a/xmodule/static_content.py b/xmodule/static_content.py index 0fd00dfe1ace..708898f4bd8c 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -23,7 +23,7 @@ from xmodule.capa_block import ProblemBlock from xmodule.conditional_block import ConditionalBlock from xmodule.html_block import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock -from xmodule.library_content_module import LibraryContentBlock +from xmodule.library_content_block import LibraryContentBlock from xmodule.lti_module import LTIBlock from xmodule.poll_module import PollBlock from xmodule.seq_module import SequenceBlock diff --git a/xmodule/tests/test_library_content.py b/xmodule/tests/test_library_content.py index 2a7d3954a9d9..e3c4347e49ba 100644 --- a/xmodule/tests/test_library_content.py +++ b/xmodule/tests/test_library_content.py @@ -14,7 +14,7 @@ from xblock.runtime import Runtime as VanillaRuntime from rest_framework import status -from xmodule.library_content_module import ANY_CAPA_TYPE_VALUE, LibraryContentBlock +from xmodule.library_content_block import ANY_CAPA_TYPE_VALUE, LibraryContentBlock from xmodule.library_tools import LibraryToolsService from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.factories import CourseFactory, LibraryFactory diff --git a/xmodule/tests/test_randomize_module.py b/xmodule/tests/test_randomize_module.py index e86209b8dbc5..15983a889ec1 100644 --- a/xmodule/tests/test_randomize_module.py +++ b/xmodule/tests/test_randomize_module.py @@ -16,7 +16,7 @@ class RandomizeBlockTest(MixedSplitTestCase): """ - Base class for tests of LibraryContentModule (library_content_module.py) + Base class for tests of LibraryContentBlock (library_content_block.py) """ maxDiff = None From 2779bd250f67f80ff8e43f5e6c0f0e120c616f92 Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:05:58 +0200 Subject: [PATCH 10/25] refactor: xmodule/lti_module.py -> xmodule/lti_block.py --- .../contentstore/views/tests/test_preview.py | 2 +- common/djangoapps/terrain/stubs/lti.py | 2 +- .../courseware/tests/test_lti_integration.py | 6 ++-- .../courseware/tests/test_module_render.py | 2 +- lms/templates/lti_form.html | 2 +- setup.py | 2 +- xmodule/{lti_module.py => lti_block.py} | 2 +- xmodule/static_content.py | 2 +- xmodule/tests/test_lti20_unit.py | 4 +-- xmodule/tests/test_lti_unit.py | 28 +++++++++---------- xmodule/x_module.py | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) rename xmodule/{lti_module.py => lti_block.py} (99%) diff --git a/cms/djangoapps/contentstore/views/tests/test_preview.py b/cms/djangoapps/contentstore/views/tests/test_preview.py index 0a0018854d39..7db140a29003 100644 --- a/cms/djangoapps/contentstore/views/tests/test_preview.py +++ b/cms/djangoapps/contentstore/views/tests/test_preview.py @@ -14,7 +14,7 @@ from xblock.core import XBlock, XBlockAside from xmodule.contentstore.django import contentstore -from xmodule.lti_module import LTIBlock +from xmodule.lti_block import LTIBlock from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import ( diff --git a/common/djangoapps/terrain/stubs/lti.py b/common/djangoapps/terrain/stubs/lti.py index 66963c8f969f..c406da5e6ed3 100644 --- a/common/djangoapps/terrain/stubs/lti.py +++ b/common/djangoapps/terrain/stubs/lti.py @@ -234,7 +234,7 @@ def _create_content(self, response_text, submit_url=None): """)).format(response=response_text, role=role, submit_form=submit_form) - # Currently LTI module doublequotes the lis_result_sourcedid parameter. + # Currently LTI block doublequotes the lis_result_sourcedid parameter. # Unquote response two times. return six.moves.urllib.parse.unquote(six.moves.urllib.parse.unquote(response_str)) diff --git a/lms/djangoapps/courseware/tests/test_lti_integration.py b/lms/djangoapps/courseware/tests/test_lti_integration.py index da4805774e26..10d331e8f1de 100644 --- a/lms/djangoapps/courseware/tests/test_lti_integration.py +++ b/lms/djangoapps/courseware/tests/test_lti_integration.py @@ -127,7 +127,7 @@ def test_lti_preview_handler(self): class TestLTIBlockListing(SharedModuleStoreTestCase): """ - a test for the rest endpoint that lists LTI modules in a course + a test for the rest endpoint that lists LTI blocks in a course """ # arbitrary constant COURSE_SLUG = "100" @@ -154,7 +154,7 @@ def setUpClass(cls): display_name="section2", category='sequential') - # creates one draft and one published lti module, in different sections + # creates one draft and one published lti block, in different sections cls.lti_published = ItemFactory.create( parent_location=cls.section1.location, display_name="lti published", @@ -189,7 +189,7 @@ def test_lti_rest_bad_course(self): assert 404 == response.status_code def test_lti_rest_listing(self): - """tests that the draft lti module is part of the endpoint response""" + """tests that the draft lti block is part of the endpoint response""" request = mock.Mock() request.method = 'GET' response = get_course_lti_endpoints(request, course_id=str(self.course.id)) diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index bc10fa8e3908..8a4b0f439190 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -45,7 +45,7 @@ from xmodule.capa_block import ProblemBlock from xmodule.contentstore.django import contentstore from xmodule.html_block import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock -from xmodule.lti_module import LTIBlock +from xmodule.lti_block import LTIBlock from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import ModuleI18nService, modulestore from xmodule.modulestore.tests.django_utils import ( diff --git a/lms/templates/lti_form.html b/lms/templates/lti_form.html index 119b82aa076f..c0f1310fb6b9 100644 --- a/lms/templates/lti_form.html +++ b/lms/templates/lti_form.html @@ -12,7 +12,7 @@ ## This form will be hidden. - ## LTI module JavaScript will trigger a "submit" on the form, and the + ## LTI block JavaScript will trigger a "submit" on the form, and the ## result will be rendered instead.
Date: Wed, 26 Oct 2022 21:06:28 +0200 Subject: [PATCH 11/25] refactor: xmodule/mako_module.py -> xmodule/mako_block.py --- xmodule/conditional_block.py | 2 +- xmodule/editing_block.py | 2 +- xmodule/library_content_block.py | 2 +- xmodule/lti_block.py | 2 +- xmodule/{mako_module.py => mako_block.py} | 0 xmodule/modulestore/mongo/base.py | 2 +- xmodule/modulestore/split_mongo/caching_descriptor_system.py | 2 +- xmodule/modulestore/xml.py | 2 +- xmodule/poll_module.py | 2 +- xmodule/randomize_module.py | 2 +- xmodule/seq_module.py | 2 +- xmodule/split_test_module.py | 2 +- xmodule/tests/__init__.py | 2 +- xmodule/tests/xml/__init__.py | 2 +- xmodule/vertical_block.py | 2 +- xmodule/video_module/video_module.py | 2 +- 16 files changed, 15 insertions(+), 15 deletions(-) rename xmodule/{mako_module.py => mako_block.py} (100%) diff --git a/xmodule/conditional_block.py b/xmodule/conditional_block.py index 54b8f6ca6c93..76296cdc3739 100644 --- a/xmodule/conditional_block.py +++ b/xmodule/conditional_block.py @@ -15,7 +15,7 @@ from xblock.fields import ReferenceList, Scope, String from openedx.core.djangolib.markup import HTML, Text -from xmodule.mako_module import MakoTemplateBlockBase +from xmodule.mako_block import MakoTemplateBlockBase from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.seq_module import SequenceMixin from xmodule.studio_editable import StudioEditableBlock diff --git a/xmodule/editing_block.py b/xmodule/editing_block.py index ce450c56bd81..c35dc57bf652 100644 --- a/xmodule/editing_block.py +++ b/xmodule/editing_block.py @@ -5,7 +5,7 @@ from xblock.fields import Scope, String -from xmodule.mako_module import MakoTemplateBlockBase +from xmodule.mako_block import MakoTemplateBlockBase log = logging.getLogger(__name__) diff --git a/xmodule/library_content_block.py b/xmodule/library_content_block.py index 81b961c688ce..a32a36266490 100644 --- a/xmodule/library_content_block.py +++ b/xmodule/library_content_block.py @@ -25,7 +25,7 @@ from xblock.fields import Integer, List, Scope, String, Boolean from xmodule.capa.responsetypes import registry -from xmodule.mako_module import MakoTemplateBlockBase +from xmodule.mako_block import MakoTemplateBlockBase from xmodule.studio_editable import StudioEditableBlock from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.validation import StudioValidation, StudioValidationMessage diff --git a/xmodule/lti_block.py b/xmodule/lti_block.py index 223cec3dbc4f..dc68bd41a5ab 100644 --- a/xmodule/lti_block.py +++ b/xmodule/lti_block.py @@ -74,7 +74,7 @@ from web_fragments.fragment import Fragment from xblock.core import List, Scope, String, XBlock from xblock.fields import Boolean, Float -from xmodule.mako_module import MakoTemplateBlockBase +from xmodule.mako_block import MakoTemplateBlockBase from openedx.core.djangolib.markup import HTML, Text from xmodule.editing_block import EditingMixin diff --git a/xmodule/mako_module.py b/xmodule/mako_block.py similarity index 100% rename from xmodule/mako_module.py rename to xmodule/mako_block.py diff --git a/xmodule/modulestore/mongo/base.py b/xmodule/modulestore/mongo/base.py index e832a60876d2..6e9f4c19fdaa 100644 --- a/xmodule/modulestore/mongo/base.py +++ b/xmodule/modulestore/mongo/base.py @@ -39,7 +39,7 @@ from xmodule.error_block import ErrorBlock from xmodule.errortracker import exc_info_to_str, null_error_tracker from xmodule.exceptions import HeartbeatFailure -from xmodule.mako_module import MakoDescriptorSystem +from xmodule.mako_block import MakoDescriptorSystem from xmodule.modulestore import BulkOperationsMixin, ModuleStoreEnum, ModuleStoreWriteBase from xmodule.modulestore.draft_and_published import DIRECT_ONLY_CATEGORIES, ModuleStoreDraftAndPublished from xmodule.modulestore.edit_info import EditInfoRuntimeMixin diff --git a/xmodule/modulestore/split_mongo/caching_descriptor_system.py b/xmodule/modulestore/split_mongo/caching_descriptor_system.py index b96dee278e2b..55aa112f5b3b 100644 --- a/xmodule/modulestore/split_mongo/caching_descriptor_system.py +++ b/xmodule/modulestore/split_mongo/caching_descriptor_system.py @@ -12,7 +12,7 @@ from xmodule.error_block import ErrorBlock from xmodule.errortracker import exc_info_to_str from xmodule.library_tools import LibraryToolsService -from xmodule.mako_module import MakoDescriptorSystem +from xmodule.mako_block import MakoDescriptorSystem from xmodule.modulestore.edit_info import EditInfoRuntimeMixin from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.inheritance import InheritanceMixin, inheriting_field_data diff --git a/xmodule/modulestore/xml.py b/xmodule/modulestore/xml.py index c7e74f180c13..4213ae6eecac 100644 --- a/xmodule/modulestore/xml.py +++ b/xmodule/modulestore/xml.py @@ -25,7 +25,7 @@ from common.djangoapps.util.monitoring import monitor_import_failure from xmodule.error_block import ErrorBlock from xmodule.errortracker import exc_info_to_str, make_error_tracker -from xmodule.mako_module import MakoDescriptorSystem +from xmodule.mako_block import MakoDescriptorSystem from xmodule.modulestore import COURSE_ROOT, LIBRARY_ROOT, ModuleStoreEnum, ModuleStoreReadBase from xmodule.modulestore.xml_exporter import DEFAULT_CONTENT_FIELDS from xmodule.tabs import CourseTabList diff --git a/xmodule/poll_module.py b/xmodule/poll_module.py index e8aebaf7d99f..6c51d8360b41 100644 --- a/xmodule/poll_module.py +++ b/xmodule/poll_module.py @@ -20,7 +20,7 @@ from xblock.core import XBlock from xblock.fields import Boolean, Dict, List, Scope, String # lint-amnesty, pylint: disable=wrong-import-order from openedx.core.djangolib.markup import Text, HTML -from xmodule.mako_module import MakoTemplateBlockBase +from xmodule.mako_block import MakoTemplateBlockBase from xmodule.stringify import stringify_children from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.x_module import ( diff --git a/xmodule/randomize_module.py b/xmodule/randomize_module.py index 8caeea20f86f..b6b0053e22b4 100644 --- a/xmodule/randomize_module.py +++ b/xmodule/randomize_module.py @@ -7,7 +7,7 @@ from lxml import etree from web_fragments.fragment import Fragment from xblock.fields import Integer, Scope -from xmodule.mako_module import MakoTemplateBlockBase +from xmodule.mako_block import MakoTemplateBlockBase from xmodule.seq_module import SequenceMixin from xmodule.xml_module import XmlMixin from xmodule.x_module import ( diff --git a/xmodule/seq_module.py b/xmodule/seq_module.py index a0b11ee793a6..ddeeaf42d879 100644 --- a/xmodule/seq_module.py +++ b/xmodule/seq_module.py @@ -37,7 +37,7 @@ from .exceptions import NotFoundError from .fields import Date -from .mako_module import MakoTemplateBlockBase +from .mako_block import MakoTemplateBlockBase from .progress import Progress from .x_module import AUTHOR_VIEW, PUBLIC_VIEW, STUDENT_VIEW from .xml_module import XmlMixin diff --git a/xmodule/split_test_module.py b/xmodule/split_test_module.py index 0953993c517b..763835d3025a 100644 --- a/xmodule/split_test_module.py +++ b/xmodule/split_test_module.py @@ -17,7 +17,7 @@ from webob import Response from xblock.core import XBlock from xblock.fields import Integer, ReferenceValueDict, Scope, String -from xmodule.mako_module import MakoTemplateBlockBase +from xmodule.mako_block import MakoTemplateBlockBase from xmodule.modulestore.inheritance import UserPartitionList from xmodule.progress import Progress from xmodule.seq_module import ProctoringFields, SequenceMixin diff --git a/xmodule/tests/__init__.py b/xmodule/tests/__init__.py index fddc7bef17e4..f268f33b4982 100644 --- a/xmodule/tests/__init__.py +++ b/xmodule/tests/__init__.py @@ -29,7 +29,7 @@ from xmodule.capa.xqueue_interface import XQueueService from xmodule.assetstore import AssetMetadata from xmodule.contentstore.django import contentstore -from xmodule.mako_module import MakoDescriptorSystem +from xmodule.mako_block import MakoDescriptorSystem from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.draft_and_published import ModuleStoreDraftAndPublished from xmodule.modulestore.inheritance import InheritanceMixin diff --git a/xmodule/tests/xml/__init__.py b/xmodule/tests/xml/__init__.py index e915b0235bbe..56b6d1a2e6bc 100644 --- a/xmodule/tests/xml/__init__.py +++ b/xmodule/tests/xml/__init__.py @@ -11,7 +11,7 @@ from opaque_keys.edx.keys import CourseKey from xblock.runtime import DictKeyValueStore, KvsFieldData -from xmodule.mako_module import MakoDescriptorSystem +from xmodule.mako_block import MakoDescriptorSystem from xmodule.modulestore.xml import CourseLocationManager from xmodule.x_module import XMLParsingSystem, policy_key diff --git a/xmodule/vertical_block.py b/xmodule/vertical_block.py index cdd2fce32b57..34c88830ee93 100644 --- a/xmodule/vertical_block.py +++ b/xmodule/vertical_block.py @@ -14,7 +14,7 @@ from xblock.core import XBlock # lint-amnesty, pylint: disable=wrong-import-order from xblock.fields import Boolean, Scope from openedx_filters.learning.filters import VerticalBlockChildRenderStarted -from xmodule.mako_module import MakoTemplateBlockBase +from xmodule.mako_block import MakoTemplateBlockBase from xmodule.progress import Progress from xmodule.seq_module import SequenceFields from xmodule.studio_editable import StudioEditableBlock diff --git a/xmodule/video_module/video_module.py b/xmodule/video_module/video_module.py index fb94a37ba83d..b8005111daa7 100644 --- a/xmodule/video_module/video_module.py +++ b/xmodule/video_module/video_module.py @@ -37,7 +37,7 @@ from xmodule.contentstore.content import StaticContent from xmodule.editing_block import EditingMixin from xmodule.exceptions import NotFoundError -from xmodule.mako_module import MakoTemplateBlockBase +from xmodule.mako_block import MakoTemplateBlockBase from xmodule.modulestore.inheritance import InheritanceKeyValueStore, own_metadata from xmodule.raw_module import EmptyDataRawMixin from xmodule.validation import StudioValidation, StudioValidationMessage From 71b835091edebebd9321d6e5a41769251e35199b Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:06:59 +0200 Subject: [PATCH 12/25] refactor: xmodule/poll_module.py -> xmodule/poll_block.py --- setup.py | 2 +- xmodule/{poll_module.py => poll_block.py} | 4 ++-- xmodule/static_content.py | 2 +- xmodule/tests/test_poll.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) rename xmodule/{poll_module.py => poll_block.py} (99%) diff --git a/setup.py b/setup.py index 27704d57391f..21d849939e28 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ "library_content = xmodule.library_content_block:LibraryContentBlock", "library_sourced = xmodule.library_sourced_block:LibrarySourcedBlock", "lti = xmodule.lti_block:LTIBlock", - "poll_question = xmodule.poll_module:PollBlock", + "poll_question = xmodule.poll_block:PollBlock", "problem = xmodule.capa_block:ProblemBlock", "randomize = xmodule.randomize_module:RandomizeBlock", "sequential = xmodule.seq_module:SequenceBlock", diff --git a/xmodule/poll_module.py b/xmodule/poll_block.py similarity index 99% rename from xmodule/poll_module.py rename to xmodule/poll_block.py index 6c51d8360b41..575a6574bfed 100644 --- a/xmodule/poll_module.py +++ b/xmodule/poll_block.py @@ -1,4 +1,4 @@ -"""Poll module is ungraded xmodule used by students to +"""Poll block is ungraded xmodule used by students to to do set of polls. On the client side we show: @@ -46,7 +46,7 @@ class PollBlock( ResourceTemplates, XModuleMixin, ): # pylint: disable=abstract-method - """Poll Module""" + """Poll Block""" # Name of poll to use in links to this poll display_name = String( help=_("The display name for this component."), diff --git a/xmodule/static_content.py b/xmodule/static_content.py index 138ddc18698a..ff586869e896 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -25,7 +25,7 @@ from xmodule.html_block import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTabBlock from xmodule.library_content_block import LibraryContentBlock from xmodule.lti_block import LTIBlock -from xmodule.poll_module import PollBlock +from xmodule.poll_block import PollBlock from xmodule.seq_module import SequenceBlock from xmodule.split_test_module import SplitTestBlock from xmodule.template_module import CustomTagBlock diff --git a/xmodule/tests/test_poll.py b/xmodule/tests/test_poll.py index a879de121495..f1a820d6c5c7 100644 --- a/xmodule/tests/test_poll.py +++ b/xmodule/tests/test_poll.py @@ -9,7 +9,7 @@ from xblock.fields import ScopeIds from openedx.core.lib.safe_lxml import etree -from xmodule.poll_module import PollBlock +from xmodule.poll_block import PollBlock from . import get_test_system from .test_import import DummySystem @@ -58,7 +58,7 @@ def test_good_ajax_request(self): def test_poll_export_with_unescaped_characters_xml(self): """ - Make sure that poll_module will export fine if its xml contains + Make sure that poll_block will export fine if its xml contains unescaped characters. """ module_system = DummySystem(load_error_modules=True) From 4aac963223f393ad9c338fb3e9001f525305827b Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:07:20 +0200 Subject: [PATCH 13/25] refactor: xmodule/randomize_module.py -> xmodule/randomize_block.py --- openedx/core/djangoapps/xblock/runtime/shims.py | 2 +- setup.py | 2 +- xmodule/{randomize_module.py => randomize_block.py} | 2 +- .../tests/{test_randomize_module.py => test_randomize_block.py} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename xmodule/{randomize_module.py => randomize_block.py} (97%) rename xmodule/tests/{test_randomize_module.py => test_randomize_block.py} (98%) diff --git a/openedx/core/djangoapps/xblock/runtime/shims.py b/openedx/core/djangoapps/xblock/runtime/shims.py index e9b57f4058cf..8bf18efad3a1 100644 --- a/openedx/core/djangoapps/xblock/runtime/shims.py +++ b/openedx/core/djangoapps/xblock/runtime/shims.py @@ -221,7 +221,7 @@ def resources_fs(self): def seed(self): """ A number to seed the random number generator. Used by capa and the - randomize module. + randomize block. Should be based on the user ID, per the existing implementation. """ diff --git a/setup.py b/setup.py index 21d849939e28..5b3bfe44865b 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ "lti = xmodule.lti_block:LTIBlock", "poll_question = xmodule.poll_block:PollBlock", "problem = xmodule.capa_block:ProblemBlock", - "randomize = xmodule.randomize_module:RandomizeBlock", + "randomize = xmodule.randomize_block:RandomizeBlock", "sequential = xmodule.seq_module:SequenceBlock", "slides = xmodule.template_module:TranslateCustomTagBlock", "split_test = xmodule.split_test_module:SplitTestBlock", diff --git a/xmodule/randomize_module.py b/xmodule/randomize_block.py similarity index 97% rename from xmodule/randomize_module.py rename to xmodule/randomize_block.py index b6b0053e22b4..cfa1a5424c5a 100644 --- a/xmodule/randomize_module.py +++ b/xmodule/randomize_block.py @@ -81,7 +81,7 @@ def child(self): child = self.get_children()[self.choice] if self.choice is not None: - log.debug("children of randomize module (should be only 1): %s", child) + log.debug("children of randomize block (should be only 1): %s", child) return child diff --git a/xmodule/tests/test_randomize_module.py b/xmodule/tests/test_randomize_block.py similarity index 98% rename from xmodule/tests/test_randomize_module.py rename to xmodule/tests/test_randomize_block.py index 15983a889ec1..c7a3511c6681 100644 --- a/xmodule/tests/test_randomize_module.py +++ b/xmodule/tests/test_randomize_block.py @@ -8,7 +8,7 @@ from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.utils import MixedSplitTestCase -from xmodule.randomize_module import RandomizeBlock +from xmodule.randomize_block import RandomizeBlock from xmodule.tests import get_test_system from .test_course_module import DummySystem as TestImportSystem From e443e253dfafb1f397cb610e0a302bb7d371f19a Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:07:37 +0200 Subject: [PATCH 14/25] refactor: xmodule/raw_module.py -> xmodule/raw_block.py --- xmodule/annotatable_block.py | 2 +- xmodule/capa_block.py | 2 +- xmodule/hidden_block.py | 2 +- xmodule/lti_block.py | 2 +- xmodule/{raw_module.py => raw_block.py} | 0 xmodule/template_module.py | 2 +- xmodule/video_module/video_module.py | 2 +- xmodule/word_cloud_module.py | 2 +- 8 files changed, 7 insertions(+), 7 deletions(-) rename xmodule/{raw_module.py => raw_block.py} (100%) diff --git a/xmodule/annotatable_block.py b/xmodule/annotatable_block.py index 760fdd724f86..1711664836a1 100644 --- a/xmodule/annotatable_block.py +++ b/xmodule/annotatable_block.py @@ -11,7 +11,7 @@ from openedx.core.djangolib.markup import HTML, Text from xmodule.editing_block import EditingMixin -from xmodule.raw_module import RawMixin +from xmodule.raw_block import RawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.xml_module import XmlMixin from xmodule.x_module import ( diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py index c3efb133cba5..c8b928cb011b 100644 --- a/xmodule/capa_block.py +++ b/xmodule/capa_block.py @@ -35,7 +35,7 @@ from xmodule.editing_block import EditingMixin from xmodule.exceptions import NotFoundError, ProcessingError from xmodule.graders import ShowCorrectness -from xmodule.raw_module import RawMixin +from xmodule.raw_block import RawMixin from xmodule.util.sandboxing import SandboxService from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.x_module import ( diff --git a/xmodule/hidden_block.py b/xmodule/hidden_block.py index 5999b777e0a7..4aa2987c2511 100644 --- a/xmodule/hidden_block.py +++ b/xmodule/hidden_block.py @@ -4,7 +4,7 @@ from web_fragments.fragment import Fragment from xblock.core import XBlock -from xmodule.raw_module import RawMixin +from xmodule.raw_block import RawMixin from xmodule.xml_module import XmlMixin from xmodule.x_module import ( XModuleMixin, diff --git a/xmodule/lti_block.py b/xmodule/lti_block.py index dc68bd41a5ab..5cb3e00fd61b 100644 --- a/xmodule/lti_block.py +++ b/xmodule/lti_block.py @@ -84,7 +84,7 @@ ATTR_KEY_USER_ROLE, ) from xmodule.lti_2_util import LTI20BlockMixin, LTIError -from xmodule.raw_module import EmptyDataRawMixin +from xmodule.raw_block import EmptyDataRawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.xml_module import XmlMixin from xmodule.x_module import ( diff --git a/xmodule/raw_module.py b/xmodule/raw_block.py similarity index 100% rename from xmodule/raw_module.py rename to xmodule/raw_block.py diff --git a/xmodule/template_module.py b/xmodule/template_module.py index 692fbea3a4c6..3cf347eaacff 100644 --- a/xmodule/template_module.py +++ b/xmodule/template_module.py @@ -9,7 +9,7 @@ from pkg_resources import resource_string from web_fragments.fragment import Fragment from xmodule.editing_block import EditingMixin -from xmodule.raw_module import RawMixin +from xmodule.raw_block import RawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.x_module import ( HTMLSnippet, diff --git a/xmodule/video_module/video_module.py b/xmodule/video_module/video_module.py index b8005111daa7..e9f191ad6244 100644 --- a/xmodule/video_module/video_module.py +++ b/xmodule/video_module/video_module.py @@ -39,7 +39,7 @@ from xmodule.exceptions import NotFoundError from xmodule.mako_block import MakoTemplateBlockBase from xmodule.modulestore.inheritance import InheritanceKeyValueStore, own_metadata -from xmodule.raw_module import EmptyDataRawMixin +from xmodule.raw_block import EmptyDataRawMixin from xmodule.validation import StudioValidation, StudioValidationMessage from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.video_module import manage_video_subtitles_save diff --git a/xmodule/word_cloud_module.py b/xmodule/word_cloud_module.py index dfad29c4e385..cf458a1c7a7d 100644 --- a/xmodule/word_cloud_module.py +++ b/xmodule/word_cloud_module.py @@ -16,7 +16,7 @@ from xblock.core import XBlock from xblock.fields import Boolean, Dict, Integer, List, Scope, String from xmodule.editing_block import EditingMixin -from xmodule.raw_module import EmptyDataRawMixin +from xmodule.raw_block import EmptyDataRawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.xml_module import XmlMixin from xmodule.x_module import ( From 70019bac045df2e8ce9b5261aa8af6145ada31ad Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:08:07 +0200 Subject: [PATCH 15/25] refactor: xmodule/seq_module.py -> xmodule/seq_block.py --- .../contentstore/tests/test_contentstore.py | 2 +- .../contentstore/tests/test_crud.py | 2 +- .../views/tests/test_course_index.py | 4 +-- .../transformers/hidden_content.py | 2 +- .../courseware/tests/test_module_render.py | 2 +- lms/djangoapps/courseware/views/index.py | 10 +++---- .../gating/tests/test_integration.py | 2 +- .../{seq_module.html => seq_block.html} | 0 openedx/core/lib/xblock_utils/__init__.py | 2 +- setup.py | 4 +-- xmodule/conditional_block.py | 2 +- xmodule/course_block.py | 2 +- xmodule/randomize_block.py | 2 +- xmodule/{seq_module.py => seq_block.py} | 2 +- xmodule/split_test_module.py | 2 +- xmodule/static_content.py | 2 +- xmodule/tests/__init__.py | 2 +- xmodule/tests/test_sequence.py | 26 +++++++++---------- xmodule/tests/test_xml_module.py | 2 +- xmodule/vertical_block.py | 2 +- 20 files changed, 37 insertions(+), 37 deletions(-) rename lms/templates/{seq_module.html => seq_block.html} (100%) rename xmodule/{seq_module.py => seq_block.py} (99%) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 3bfd30734586..847b4eeeec24 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -37,7 +37,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls from xmodule.modulestore.xml_exporter import export_course_to_xml from xmodule.modulestore.xml_importer import import_course_from_xml, perform_xlint -from xmodule.seq_module import SequenceBlock +from xmodule.seq_block import SequenceBlock from xmodule.video_module import VideoBlock from cms.djangoapps.contentstore.config import waffle diff --git a/cms/djangoapps/contentstore/tests/test_crud.py b/cms/djangoapps/contentstore/tests/test_crud.py index 1ae40b0dfdd6..371e9fd35d4d 100644 --- a/cms/djangoapps/contentstore/tests/test_crud.py +++ b/cms/djangoapps/contentstore/tests/test_crud.py @@ -9,7 +9,7 @@ from xmodule.modulestore.exceptions import DuplicateCourseError from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory -from xmodule.seq_module import SequenceBlock +from xmodule.seq_block import SequenceBlock class TemplateTests(ModuleStoreTestCase): diff --git a/cms/djangoapps/contentstore/views/tests/test_course_index.py b/cms/djangoapps/contentstore/views/tests/test_course_index.py index e05b500a7d16..a954a34632e6 100644 --- a/cms/djangoapps/contentstore/views/tests/test_course_index.py +++ b/cms/djangoapps/contentstore/views/tests/test_course_index.py @@ -813,7 +813,7 @@ def test_reindex_html_error_json_responses(self, mock_index_dictionary): with self.assertRaises(SearchIndexingError): reindex_course_and_check_access(self.course.id, self.user) - @mock.patch('xmodule.seq_module.SequenceBlock.index_dictionary') + @mock.patch('xmodule.seq_block.SequenceBlock.index_dictionary') def test_reindex_seq_error_json_responses(self, mock_index_dictionary): """ Test json response with mocked error data for sequence @@ -923,7 +923,7 @@ def test_indexing_html_error_responses(self, mock_index_dictionary): with self.assertRaises(SearchIndexingError): CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id) - @mock.patch('xmodule.seq_module.SequenceBlock.index_dictionary') + @mock.patch('xmodule.seq_block.SequenceBlock.index_dictionary') def test_indexing_seq_error_responses(self, mock_index_dictionary): """ Test do_course_reindex response with mocked error data for sequence diff --git a/lms/djangoapps/course_blocks/transformers/hidden_content.py b/lms/djangoapps/course_blocks/transformers/hidden_content.py index b0bbd7f13736..e82d8d3441d6 100644 --- a/lms/djangoapps/course_blocks/transformers/hidden_content.py +++ b/lms/djangoapps/course_blocks/transformers/hidden_content.py @@ -8,7 +8,7 @@ from pytz import utc from openedx.core.djangoapps.content.block_structure.transformer import BlockStructureTransformer -from xmodule.seq_module import SequenceBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.seq_block import SequenceBlock # lint-amnesty, pylint: disable=wrong-import-order from .utils import collect_merged_boolean_field, collect_merged_date_field diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index 8a4b0f439190..363de536d79f 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -920,7 +920,7 @@ def test_anonymous_user_not_be_graded(self, mock_score_signal): assert not mock_score_signal.called @ddt.data( - # See seq_module.py for the definition of these handlers + # See seq_block.py for the definition of these handlers ('get_completion', True), # has the 'will_recheck_access' attribute set to True ('goto_position', False), # does not set it ) diff --git a/lms/djangoapps/courseware/views/index.py b/lms/djangoapps/courseware/views/index.py index 407874112ec3..b51cc00a5982 100644 --- a/lms/djangoapps/courseware/views/index.py +++ b/lms/djangoapps/courseware/views/index.py @@ -561,17 +561,17 @@ def render_accordion(request, course, table_of_contents): return render_to_string('courseware/accordion.html', context) -def save_child_position(seq_module, child_name): +def save_child_position(seq_block, child_name): """ child_name: url_name of the child """ - for position, child in enumerate(seq_module.get_display_items(), start=1): + for position, child in enumerate(seq_block.get_display_items(), start=1): if child.location.block_id == child_name: # Only save if position changed - if position != seq_module.position: - seq_module.position = position + if position != seq_block.position: + seq_block.position = position # Save this new position to the underlying KeyValueStore - seq_module.save() + seq_block.save() def save_positions_recursively_up(user, request, field_data_cache, xmodule, course=None): diff --git a/lms/djangoapps/gating/tests/test_integration.py b/lms/djangoapps/gating/tests/test_integration.py index b58073f5c2b6..608231c2a1e3 100644 --- a/lms/djangoapps/gating/tests/test_integration.py +++ b/lms/djangoapps/gating/tests/test_integration.py @@ -149,7 +149,7 @@ def assert_access_to_gated_content(self, user): # access to gating content (seq1) remains constant assert bool(has_access(user, 'load', self.seq1, self.course.id)) - # access to gated content (seq2) remains constant, access is prevented in SeqModule loading + # access to gated content (seq2) remains constant, access is prevented in SeqBlock loading assert bool(has_access(user, 'load', self.seq2, self.course.id)) def assert_user_has_prereq_milestone(self, user, expected_has_milestone): diff --git a/lms/templates/seq_module.html b/lms/templates/seq_block.html similarity index 100% rename from lms/templates/seq_module.html rename to lms/templates/seq_block.html diff --git a/openedx/core/lib/xblock_utils/__init__.py b/openedx/core/lib/xblock_utils/__init__.py index ca881bd02d50..1674b2757fc5 100644 --- a/openedx/core/lib/xblock_utils/__init__.py +++ b/openedx/core/lib/xblock_utils/__init__.py @@ -28,7 +28,7 @@ from common.djangoapps import static_replace from common.djangoapps.edxmako.shortcuts import render_to_string -from xmodule.seq_module import SequenceBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.seq_block import SequenceBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.util.xmodule_django import add_webpack_to_fragment # lint-amnesty, pylint: disable=wrong-import-order from xmodule.vertical_block import VerticalBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.x_module import ( # lint-amnesty, pylint: disable=wrong-import-order diff --git a/setup.py b/setup.py index 5b3bfe44865b..db9bdf31e1b0 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ "about = xmodule.html_block:AboutBlock", "book = xmodule.template_module:TranslateCustomTagBlock", "annotatable = xmodule.annotatable_block:AnnotatableBlock", - "chapter = xmodule.seq_module:SectionBlock", + "chapter = xmodule.seq_block:SectionBlock", "conditional = xmodule.conditional_block:ConditionalBlock", "course = xmodule.course_block:CourseBlock", "course_info = xmodule.html_block:CourseInfoBlock", @@ -27,7 +27,7 @@ "poll_question = xmodule.poll_block:PollBlock", "problem = xmodule.capa_block:ProblemBlock", "randomize = xmodule.randomize_block:RandomizeBlock", - "sequential = xmodule.seq_module:SequenceBlock", + "sequential = xmodule.seq_block:SequenceBlock", "slides = xmodule.template_module:TranslateCustomTagBlock", "split_test = xmodule.split_test_module:SplitTestBlock", "static_tab = xmodule.html_block:StaticTabBlock", diff --git a/xmodule/conditional_block.py b/xmodule/conditional_block.py index 76296cdc3739..3422a892ce11 100644 --- a/xmodule/conditional_block.py +++ b/xmodule/conditional_block.py @@ -17,7 +17,7 @@ from openedx.core.djangolib.markup import HTML, Text from xmodule.mako_block import MakoTemplateBlockBase from xmodule.modulestore.exceptions import ItemNotFoundError -from xmodule.seq_module import SequenceMixin +from xmodule.seq_block import SequenceMixin from xmodule.studio_editable import StudioEditableBlock from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.validation import StudioValidation, StudioValidationMessage diff --git a/xmodule/course_block.py b/xmodule/course_block.py index 99ff1e84cda5..406c6a17d1b8 100644 --- a/xmodule/course_block.py +++ b/xmodule/course_block.py @@ -23,7 +23,7 @@ from xmodule.course_metadata_utils import DEFAULT_GRADING_POLICY, DEFAULT_START_DATE from xmodule.data import CertificatesDisplayBehaviors from xmodule.graders import grader_from_conf -from xmodule.seq_module import SequenceBlock +from xmodule.seq_block import SequenceBlock from xmodule.tabs import CourseTabList, InvalidTabsException from .fields import Date diff --git a/xmodule/randomize_block.py b/xmodule/randomize_block.py index cfa1a5424c5a..15b6bc0f36de 100644 --- a/xmodule/randomize_block.py +++ b/xmodule/randomize_block.py @@ -8,7 +8,7 @@ from web_fragments.fragment import Fragment from xblock.fields import Integer, Scope from xmodule.mako_block import MakoTemplateBlockBase -from xmodule.seq_module import SequenceMixin +from xmodule.seq_block import SequenceMixin from xmodule.xml_module import XmlMixin from xmodule.x_module import ( HTMLSnippet, diff --git a/xmodule/seq_module.py b/xmodule/seq_block.py similarity index 99% rename from xmodule/seq_module.py rename to xmodule/seq_block.py index ddeeaf42d879..bd5cba7a016c 100644 --- a/xmodule/seq_module.py +++ b/xmodule/seq_block.py @@ -615,7 +615,7 @@ def _student_or_public_view(self, context, prereq_met, prereq_meta_info, banner_ parent_block_id = self.get_parent().scope_ids.usage_id.block_id params['chapter_completion_aggregator_url'] = '/'.join( [settings.COMPLETION_AGGREGATOR_URL, str(self.scope_ids.usage_id.context_key), parent_block_id]) + '/' - fragment.add_content(self.runtime.service(self, 'mako').render_template("seq_module.html", params)) + fragment.add_content(self.runtime.service(self, 'mako').render_template("seq_block.html", params)) self._capture_full_seq_item_metrics(display_items) self._capture_current_unit_metrics(display_items) diff --git a/xmodule/split_test_module.py b/xmodule/split_test_module.py index 763835d3025a..51ce967a15ba 100644 --- a/xmodule/split_test_module.py +++ b/xmodule/split_test_module.py @@ -20,7 +20,7 @@ from xmodule.mako_block import MakoTemplateBlockBase from xmodule.modulestore.inheritance import UserPartitionList from xmodule.progress import Progress -from xmodule.seq_module import ProctoringFields, SequenceMixin +from xmodule.seq_block import ProctoringFields, SequenceMixin from xmodule.studio_editable import StudioEditableBlock from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.validation import StudioValidation, StudioValidationMessage diff --git a/xmodule/static_content.py b/xmodule/static_content.py index ff586869e896..d3ef5a478177 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -26,7 +26,7 @@ from xmodule.library_content_block import LibraryContentBlock from xmodule.lti_block import LTIBlock from xmodule.poll_block import PollBlock -from xmodule.seq_module import SequenceBlock +from xmodule.seq_block import SequenceBlock from xmodule.split_test_module import SplitTestBlock from xmodule.template_module import CustomTagBlock from xmodule.word_cloud_module import WordCloudBlock diff --git a/xmodule/tests/__init__.py b/xmodule/tests/__init__.py index f268f33b4982..4bdb43c9bba0 100644 --- a/xmodule/tests/__init__.py +++ b/xmodule/tests/__init__.py @@ -183,7 +183,7 @@ class ModelsTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-cl def test_load_class(self): vc = XBlock.load_class('sequential') - vc_str = "" + vc_str = "" assert str(vc) == vc_str diff --git a/xmodule/tests/test_sequence.py b/xmodule/tests/test_sequence.py index bf0e16fb1e2b..1fb744635c52 100644 --- a/xmodule/tests/test_sequence.py +++ b/xmodule/tests/test_sequence.py @@ -18,7 +18,7 @@ from edx_toggles.toggles.testutils import override_waffle_flag from openedx.features.content_type_gating.models import ContentTypeGatingConfig -from xmodule.seq_module import TIMED_EXAM_GATING_WAFFLE_FLAG, SequenceBlock +from xmodule.seq_block import TIMED_EXAM_GATING_WAFFLE_FLAG, SequenceBlock from xmodule.tests import get_test_system from xmodule.tests.helpers import StubUserService from xmodule.tests.xml import XModuleXmlImportTest @@ -141,9 +141,9 @@ def _assert_view_at_position(self, rendered_html, expected_position): def test_student_view_init(self): module_system = get_test_system() module_system.position = 2 - seq_module = SequenceBlock(runtime=module_system, scope_ids=Mock()) - seq_module.bind_for_student(module_system, 34) - assert seq_module.position == 2 + seq_block = SequenceBlock(runtime=module_system, scope_ids=Mock()) + seq_block.bind_for_student(module_system, 34) + assert seq_block.position == 2 # matches position set in the runtime @ddt.unpack @@ -165,7 +165,7 @@ def test_render_student_view(self, view): assert 'fa fa-check-circle check-circle is-hidden' not in html # pylint: disable=line-too-long - @patch('xmodule.seq_module.SequenceBlock.gate_entire_sequence_if_it_is_a_timed_exam_and_contains_content_type_gated_problems') + @patch('xmodule.seq_block.SequenceBlock.gate_entire_sequence_if_it_is_a_timed_exam_and_contains_content_type_gated_problems') def test_timed_exam_gating_waffle_flag(self, mocked_function): # pylint: disable=unused-argument """ Verify the code inside the waffle flag is not executed with the flag off @@ -209,7 +209,7 @@ def test_that_timed_sequence_gating_respects_access_configurations(self): ) assert 'i_am_gated' in view # check a few elements to ensure the correct page was loaded - assert 'seq_module.html' in view + assert 'seq_block.html' in view assert 'NextSequential' in view assert 'PrevSequential' in view @@ -240,7 +240,7 @@ def test_tooltip(self): def test_hidden_content_before_due(self): html = self._get_rendered_view(self.sequence_4_1) - assert 'seq_module.html' in html + assert 'seq_block.html' in html assert "'banner_text': None" in html def test_hidden_content_past_due(self): @@ -259,14 +259,14 @@ def test_masquerade_hidden_content_past_due(self): self.sequence_4_1, extra_context=dict(specific_masquerade=True), ) - assert 'seq_module.html' in html + assert 'seq_block.html' in html html = self.get_context_dict_from_string(html) assert 'Because the due date has passed, this assignment is hidden from the learner.' == html['banner_text'] def test_hidden_content_self_paced_past_due_before_end(self): with freeze_time(PAST_DUE_BEFORE_END_DATE): html = self._get_rendered_view(self.sequence_4_1, self_paced=True) - assert 'seq_module.html' in html + assert 'seq_block.html' in html assert "'banner_text': None" in html def test_hidden_content_self_paced_past_end(self): @@ -284,7 +284,7 @@ def _assert_gated(self, html, sequence): """ Assert sequence content is gated """ - assert 'seq_module.html' in html + assert 'seq_block.html' in html html = self.get_context_dict_from_string(html) assert html['banner_text'] is None assert [] == html['items'] @@ -299,7 +299,7 @@ def _assert_prereq(self, html, sequence): """ Assert sequence is a prerequisite with unfulfilled gates """ - assert 'seq_module.html' in html + assert 'seq_block.html' in html html = self.get_context_dict_from_string(html) assert 'This section is a prerequisite. You must complete this section in order to unlock additional content.' == html['banner_text'] assert not html['gated_content']['gated'] @@ -313,7 +313,7 @@ def _assert_ungated(self, html, sequence): """ Assert sequence is not gated """ - assert 'seq_module.html' in html + assert 'seq_block.html' in html assert "'banner_text': None" in html assert "'gated': False" in html assert str(sequence.location) in html @@ -464,5 +464,5 @@ def get_context_dict_from_string(self, data): Retrieve dictionary from string. """ # Replace tuple and un-necessary info from inside string and get the dictionary. - cleaned_data = data.replace("(('seq_module.html',\n", '').replace("),\n {})", '').strip() + cleaned_data = data.replace("(('seq_block.html',\n", '').replace("),\n {})", '').strip() return ast.literal_eval(cleaned_data) diff --git a/xmodule/tests/test_xml_module.py b/xmodule/tests/test_xml_module.py index f36782075f01..b15dc3529f1d 100644 --- a/xmodule/tests/test_xml_module.py +++ b/xmodule/tests/test_xml_module.py @@ -15,7 +15,7 @@ from xmodule.fields import Date, RelativeTime, Timedelta from xmodule.modulestore.inheritance import InheritanceKeyValueStore, InheritanceMixin, InheritingFieldData from xmodule.modulestore.split_mongo.split_mongo_kvs import SplitMongoKVS -from xmodule.seq_module import SequenceBlock +from xmodule.seq_block import SequenceBlock from xmodule.tests import get_test_descriptor_system from xmodule.tests.xml import XModuleXmlImportTest from xmodule.tests.xml.factories import CourseFactory, ProblemFactory, SequenceFactory diff --git a/xmodule/vertical_block.py b/xmodule/vertical_block.py index 34c88830ee93..e7c8682188b9 100644 --- a/xmodule/vertical_block.py +++ b/xmodule/vertical_block.py @@ -16,7 +16,7 @@ from openedx_filters.learning.filters import VerticalBlockChildRenderStarted from xmodule.mako_block import MakoTemplateBlockBase from xmodule.progress import Progress -from xmodule.seq_module import SequenceFields +from xmodule.seq_block import SequenceFields from xmodule.studio_editable import StudioEditableBlock from xmodule.util.misc import is_xblock_an_assignment from xmodule.util.xmodule_django import add_webpack_to_fragment From a2c5e07b41595b012561da7bc69bba489c5a53ea Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:08:42 +0200 Subject: [PATCH 16/25] refactor: xmodule/template_module.py -> xmodule/template_block.py --- setup.py | 14 +++++++------- xmodule/static_content.py | 2 +- xmodule/{template_module.py => template_block.py} | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) rename xmodule/{template_module.py => template_block.py} (96%) diff --git a/setup.py b/setup.py index db9bdf31e1b0..195349aa2860 100644 --- a/setup.py +++ b/setup.py @@ -6,20 +6,20 @@ XBLOCKS = [ "about = xmodule.html_block:AboutBlock", - "book = xmodule.template_module:TranslateCustomTagBlock", + "book = xmodule.template_block:TranslateCustomTagBlock", "annotatable = xmodule.annotatable_block:AnnotatableBlock", "chapter = xmodule.seq_block:SectionBlock", "conditional = xmodule.conditional_block:ConditionalBlock", "course = xmodule.course_block:CourseBlock", "course_info = xmodule.html_block:CourseInfoBlock", - "customtag = xmodule.template_module:CustomTagBlock", - "custom_tag_template = xmodule.template_module:CustomTagTemplateBlock", - "discuss = xmodule.template_module:TranslateCustomTagBlock", + "customtag = xmodule.template_block:CustomTagBlock", + "custom_tag_template = xmodule.template_block:CustomTagTemplateBlock", + "discuss = xmodule.template_block:TranslateCustomTagBlock", "discussion = xmodule.discussion_block:DiscussionXBlock", "error = xmodule.error_block:ErrorBlock", "hidden = xmodule.hidden_block:HiddenDescriptor", "html = xmodule.html_block:HtmlBlock", - "image = xmodule.template_module:TranslateCustomTagBlock", + "image = xmodule.template_block:TranslateCustomTagBlock", "library = xmodule.library_root_xblock:LibraryRoot", "library_content = xmodule.library_content_block:LibraryContentBlock", "library_sourced = xmodule.library_sourced_block:LibrarySourcedBlock", @@ -28,14 +28,14 @@ "problem = xmodule.capa_block:ProblemBlock", "randomize = xmodule.randomize_block:RandomizeBlock", "sequential = xmodule.seq_block:SequenceBlock", - "slides = xmodule.template_module:TranslateCustomTagBlock", + "slides = xmodule.template_block:TranslateCustomTagBlock", "split_test = xmodule.split_test_module:SplitTestBlock", "static_tab = xmodule.html_block:StaticTabBlock", "unit = xmodule.unit_block:UnitBlock", "vertical = xmodule.vertical_block:VerticalBlock", "video = xmodule.video_module:VideoBlock", "videoalpha = xmodule.video_module:VideoBlock", - "videodev = xmodule.template_module:TranslateCustomTagBlock", + "videodev = xmodule.template_block:TranslateCustomTagBlock", "word_cloud = xmodule.word_cloud_module:WordCloudBlock", "wrapper = xmodule.wrapper_module:WrapperBlock", ] diff --git a/xmodule/static_content.py b/xmodule/static_content.py index d3ef5a478177..32000dec83db 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -28,7 +28,7 @@ from xmodule.poll_block import PollBlock from xmodule.seq_block import SequenceBlock from xmodule.split_test_module import SplitTestBlock -from xmodule.template_module import CustomTagBlock +from xmodule.template_block import CustomTagBlock from xmodule.word_cloud_module import WordCloudBlock from xmodule.x_module import HTMLSnippet diff --git a/xmodule/template_module.py b/xmodule/template_block.py similarity index 96% rename from xmodule/template_module.py rename to xmodule/template_block.py index 3cf347eaacff..e83a2a34df4f 100644 --- a/xmodule/template_module.py +++ b/xmodule/template_block.py @@ -1,5 +1,5 @@ """ -Template module +Template block """ from string import Template @@ -111,9 +111,9 @@ def render_template(self, system, xml_data): # cdodge: look up the template as a module template_loc = self.location.replace(category='custom_tag_template', name=template_name) - template_module = system.load_item(template_loc) - template_module_data = template_module.data - template = Template(template_module_data) + template_block = system.load_item(template_loc) + template_block_data = template_block.data + template = Template(template_block_data) return template.safe_substitute(params) @property From 071b4ba1b41fee7d72305bd4245f1260ec90d104 Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:09:15 +0200 Subject: [PATCH 17/25] refactor: xmodule/word_cloud_module.py -> xmodule/word_cloud_block.py --- lms/djangoapps/courseware/tests/test_word_cloud.py | 2 +- setup.py | 2 +- xmodule/static_content.py | 2 +- xmodule/tests/test_word_cloud.py | 6 +++--- xmodule/{word_cloud_module.py => word_cloud_block.py} | 0 5 files changed, 6 insertions(+), 6 deletions(-) rename xmodule/{word_cloud_module.py => word_cloud_block.py} (100%) diff --git a/lms/djangoapps/courseware/tests/test_word_cloud.py b/lms/djangoapps/courseware/tests/test_word_cloud.py index e80c73332dbb..2ba9ba837466 100644 --- a/lms/djangoapps/courseware/tests/test_word_cloud.py +++ b/lms/djangoapps/courseware/tests/test_word_cloud.py @@ -10,7 +10,7 @@ class TestWordCloud(BaseTestXmodule): - """Integration test for word cloud xmodule.""" + """Integration test for Word Cloud Block.""" CATEGORY = "word_cloud" def _get_resource_url(self, item): diff --git a/setup.py b/setup.py index 195349aa2860..de935056d359 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ "video = xmodule.video_module:VideoBlock", "videoalpha = xmodule.video_module:VideoBlock", "videodev = xmodule.template_block:TranslateCustomTagBlock", - "word_cloud = xmodule.word_cloud_module:WordCloudBlock", + "word_cloud = xmodule.word_cloud_block:WordCloudBlock", "wrapper = xmodule.wrapper_module:WrapperBlock", ] XBLOCKS_ASIDES = [ diff --git a/xmodule/static_content.py b/xmodule/static_content.py index 32000dec83db..692233ee4c2d 100755 --- a/xmodule/static_content.py +++ b/xmodule/static_content.py @@ -29,7 +29,7 @@ from xmodule.seq_block import SequenceBlock from xmodule.split_test_module import SplitTestBlock from xmodule.template_block import CustomTagBlock -from xmodule.word_cloud_module import WordCloudBlock +from xmodule.word_cloud_block import WordCloudBlock from xmodule.x_module import HTMLSnippet LOG = logging.getLogger(__name__) diff --git a/xmodule/tests/test_word_cloud.py b/xmodule/tests/test_word_cloud.py index 17f91afab72c..79923d7c88fb 100644 --- a/xmodule/tests/test_word_cloud.py +++ b/xmodule/tests/test_word_cloud.py @@ -1,4 +1,4 @@ -"""Test for Word cloud Xmodule functional logic.""" +"""Test for Word Cloud Block functional logic.""" import json from unittest.mock import Mock @@ -10,13 +10,13 @@ from webob.multidict import MultiDict from xblock.field_data import DictFieldData -from xmodule.word_cloud_module import WordCloudBlock +from xmodule.word_cloud_block import WordCloudBlock from . import get_test_descriptor_system, get_test_system class WordCloudBlockTest(TestCase): """ - Logic tests for Word Cloud XBlock. + Logic tests for Word Cloud Block. """ raw_field_data = { diff --git a/xmodule/word_cloud_module.py b/xmodule/word_cloud_block.py similarity index 100% rename from xmodule/word_cloud_module.py rename to xmodule/word_cloud_block.py From 7fa5f3847b53e057bafed14599db56eaaa18285b Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:09:36 +0200 Subject: [PATCH 18/25] refactor: xmodule/wrapper_module.py -> xmodule/wrapper_block.py --- setup.py | 2 +- xmodule/{wrapper_module.py => wrapper_block.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename xmodule/{wrapper_module.py => wrapper_block.py} (100%) diff --git a/setup.py b/setup.py index de935056d359..e5ec1b88660c 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ "videoalpha = xmodule.video_module:VideoBlock", "videodev = xmodule.template_block:TranslateCustomTagBlock", "word_cloud = xmodule.word_cloud_block:WordCloudBlock", - "wrapper = xmodule.wrapper_module:WrapperBlock", + "wrapper = xmodule.wrapper_block:WrapperBlock", ] XBLOCKS_ASIDES = [ 'tagging_aside = cms.lib.xblock.tagging:StructuredTagsAside', diff --git a/xmodule/wrapper_module.py b/xmodule/wrapper_block.py similarity index 100% rename from xmodule/wrapper_module.py rename to xmodule/wrapper_block.py From 685f1cd679d0fe17007443e6b8107618ce0fc7a2 Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:10:10 +0200 Subject: [PATCH 19/25] refactor: xmodule/xml_module.py -> xmodule/xml_block.py --- openedx/core/djangoapps/olx_rest_api/adapters.py | 2 +- openedx/core/djangoapps/xblock/runtime/serializer.py | 2 +- xmodule/annotatable_block.py | 2 +- xmodule/capa_block.py | 2 +- xmodule/conditional_block.py | 2 +- xmodule/discussion_block.py | 2 +- xmodule/hidden_block.py | 2 +- xmodule/html_block.py | 2 +- xmodule/library_content_block.py | 2 +- xmodule/lti_block.py | 2 +- xmodule/poll_block.py | 2 +- xmodule/randomize_block.py | 2 +- xmodule/seq_block.py | 2 +- xmodule/split_test_module.py | 2 +- xmodule/template_block.py | 2 +- xmodule/tests/test_import.py | 2 +- xmodule/tests/{test_xml_module.py => test_xml_block.py} | 2 +- xmodule/vertical_block.py | 2 +- xmodule/video_module/video_module.py | 2 +- xmodule/word_cloud_block.py | 2 +- xmodule/{xml_module.py => xml_block.py} | 0 21 files changed, 20 insertions(+), 20 deletions(-) rename xmodule/tests/{test_xml_module.py => test_xml_block.py} (99%) rename xmodule/{xml_module.py => xml_block.py} (100%) diff --git a/openedx/core/djangoapps/olx_rest_api/adapters.py b/openedx/core/djangoapps/olx_rest_api/adapters.py index 4db3cb03aa34..43aedda7d4ac 100644 --- a/openedx/core/djangoapps/olx_rest_api/adapters.py +++ b/openedx/core/djangoapps/olx_rest_api/adapters.py @@ -14,7 +14,7 @@ from xmodule.exceptions import NotFoundError from xmodule.modulestore.django import modulestore as store from xmodule.modulestore.exceptions import ItemNotFoundError -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from common.djangoapps.static_replace import replace_static_urls diff --git a/openedx/core/djangoapps/xblock/runtime/serializer.py b/openedx/core/djangoapps/xblock/runtime/serializer.py index 3cf803b4db3a..f1c188afb826 100644 --- a/openedx/core/djangoapps/xblock/runtime/serializer.py +++ b/openedx/core/djangoapps/xblock/runtime/serializer.py @@ -12,7 +12,7 @@ from lxml.etree import Element from lxml.etree import tostring as etree_tostring -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin log = logging.getLogger(__name__) diff --git a/xmodule/annotatable_block.py b/xmodule/annotatable_block.py index 1711664836a1..774ad900979b 100644 --- a/xmodule/annotatable_block.py +++ b/xmodule/annotatable_block.py @@ -13,7 +13,7 @@ from xmodule.editing_block import EditingMixin from xmodule.raw_block import RawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from xmodule.x_module import ( HTMLSnippet, ResourceTemplates, diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py index c8b928cb011b..4cf6f80e537c 100644 --- a/xmodule/capa_block.py +++ b/xmodule/capa_block.py @@ -45,7 +45,7 @@ XModuleToXBlockMixin, shim_xmodule_js ) -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from common.djangoapps.xblock_django.constants import ( ATTR_KEY_ANONYMOUS_USER_ID, ATTR_KEY_USER_IS_STAFF, diff --git a/xmodule/conditional_block.py b/xmodule/conditional_block.py index 3422a892ce11..db6dd2100f4a 100644 --- a/xmodule/conditional_block.py +++ b/xmodule/conditional_block.py @@ -21,7 +21,7 @@ from xmodule.studio_editable import StudioEditableBlock from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.validation import StudioValidation, StudioValidationMessage -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from xmodule.x_module import ( HTMLSnippet, ResourceTemplates, diff --git a/xmodule/discussion_block.py b/xmodule/discussion_block.py index 63106fa9f258..84d5fdfb4afb 100644 --- a/xmodule/discussion_block.py +++ b/xmodule/discussion_block.py @@ -18,7 +18,7 @@ from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration, Provider from openedx.core.djangolib.markup import HTML, Text from openedx.core.lib.xblock_utils import get_css_dependencies, get_js_dependencies -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin log = logging.getLogger(__name__) loader = ResourceLoader(__name__) # pylint: disable=invalid-name diff --git a/xmodule/hidden_block.py b/xmodule/hidden_block.py index 4aa2987c2511..0ed8a10ec71d 100644 --- a/xmodule/hidden_block.py +++ b/xmodule/hidden_block.py @@ -5,7 +5,7 @@ from web_fragments.fragment import Fragment from xblock.core import XBlock from xmodule.raw_block import RawMixin -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from xmodule.x_module import ( XModuleMixin, XModuleToXBlockMixin, diff --git a/xmodule/html_block.py b/xmodule/html_block.py index 5913312a4474..2c3e24d37ed8 100644 --- a/xmodule/html_block.py +++ b/xmodule/html_block.py @@ -32,7 +32,7 @@ XModuleMixin, XModuleToXBlockMixin, ) -from xmodule.xml_module import XmlMixin, name_to_pathname +from xmodule.xml_block import XmlMixin, name_to_pathname log = logging.getLogger("edx.courseware") diff --git a/xmodule/library_content_block.py b/xmodule/library_content_block.py index a32a36266490..94bf54fec08f 100644 --- a/xmodule/library_content_block.py +++ b/xmodule/library_content_block.py @@ -29,7 +29,7 @@ from xmodule.studio_editable import StudioEditableBlock from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.validation import StudioValidation, StudioValidationMessage -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from xmodule.x_module import ( HTMLSnippet, ResourceTemplates, diff --git a/xmodule/lti_block.py b/xmodule/lti_block.py index 5cb3e00fd61b..795db6c64e97 100644 --- a/xmodule/lti_block.py +++ b/xmodule/lti_block.py @@ -86,7 +86,7 @@ from xmodule.lti_2_util import LTI20BlockMixin, LTIError from xmodule.raw_block import EmptyDataRawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from xmodule.x_module import ( HTMLSnippet, ResourceTemplates, diff --git a/xmodule/poll_block.py b/xmodule/poll_block.py index 575a6574bfed..b29ed710e922 100644 --- a/xmodule/poll_block.py +++ b/xmodule/poll_block.py @@ -30,7 +30,7 @@ XModuleMixin, XModuleToXBlockMixin, ) -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin log = logging.getLogger(__name__) diff --git a/xmodule/randomize_block.py b/xmodule/randomize_block.py index 15b6bc0f36de..a9c6a706df41 100644 --- a/xmodule/randomize_block.py +++ b/xmodule/randomize_block.py @@ -9,7 +9,7 @@ from xblock.fields import Integer, Scope from xmodule.mako_block import MakoTemplateBlockBase from xmodule.seq_block import SequenceMixin -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from xmodule.x_module import ( HTMLSnippet, ResourceTemplates, diff --git a/xmodule/seq_block.py b/xmodule/seq_block.py index bd5cba7a016c..fae726d1e3ca 100644 --- a/xmodule/seq_block.py +++ b/xmodule/seq_block.py @@ -40,7 +40,7 @@ from .mako_block import MakoTemplateBlockBase from .progress import Progress from .x_module import AUTHOR_VIEW, PUBLIC_VIEW, STUDENT_VIEW -from .xml_module import XmlMixin +from .xml_block import XmlMixin log = logging.getLogger(__name__) diff --git a/xmodule/split_test_module.py b/xmodule/split_test_module.py index 51ce967a15ba..63f728352ccf 100644 --- a/xmodule/split_test_module.py +++ b/xmodule/split_test_module.py @@ -24,7 +24,7 @@ from xmodule.studio_editable import StudioEditableBlock from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.validation import StudioValidation, StudioValidationMessage -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from xmodule.x_module import ( HTMLSnippet, ResourceTemplates, diff --git a/xmodule/template_block.py b/xmodule/template_block.py index e83a2a34df4f..2d2d6a531364 100644 --- a/xmodule/template_block.py +++ b/xmodule/template_block.py @@ -18,7 +18,7 @@ XModuleMixin, XModuleToXBlockMixin, ) -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from openedx.core.djangolib.markup import Text diff --git a/xmodule/tests/test_import.py b/xmodule/tests/test_import.py index ca151c34887b..543f8c62f010 100644 --- a/xmodule/tests/test_import.py +++ b/xmodule/tests/test_import.py @@ -22,7 +22,7 @@ from xmodule.modulestore.xml import ImportSystem, LibraryXMLModuleStore, XMLModuleStore from xmodule.tests import DATA_DIR from xmodule.x_module import XModuleMixin -from xmodule.xml_module import is_pointer_tag +from xmodule.xml_block import is_pointer_tag ORG = 'test_org' COURSE = 'test_course' diff --git a/xmodule/tests/test_xml_module.py b/xmodule/tests/test_xml_block.py similarity index 99% rename from xmodule/tests/test_xml_module.py rename to xmodule/tests/test_xml_block.py index b15dc3529f1d..24ab557df316 100644 --- a/xmodule/tests/test_xml_module.py +++ b/xmodule/tests/test_xml_block.py @@ -20,7 +20,7 @@ from xmodule.tests.xml import XModuleXmlImportTest from xmodule.tests.xml.factories import CourseFactory, ProblemFactory, SequenceFactory from xmodule.x_module import XModuleMixin -from xmodule.xml_module import XmlMixin, deserialize_field, serialize_field +from xmodule.xml_block import XmlMixin, deserialize_field, serialize_field class CrazyJsonString(String): diff --git a/xmodule/vertical_block.py b/xmodule/vertical_block.py index e7c8682188b9..b800d549f6ae 100644 --- a/xmodule/vertical_block.py +++ b/xmodule/vertical_block.py @@ -21,7 +21,7 @@ from xmodule.util.misc import is_xblock_an_assignment from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.x_module import PUBLIC_VIEW, STUDENT_VIEW, XModuleFields -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin log = logging.getLogger(__name__) diff --git a/xmodule/video_module/video_module.py b/xmodule/video_module/video_module.py index e9f191ad6244..f189d088f7ff 100644 --- a/xmodule/video_module/video_module.py +++ b/xmodule/video_module/video_module.py @@ -48,7 +48,7 @@ HTMLSnippet, ResourceTemplates, shim_xmodule_js, XModuleMixin, XModuleToXBlockMixin, ) -from xmodule.xml_module import XmlMixin, deserialize_field, is_pointer_tag, name_to_pathname +from xmodule.xml_block import XmlMixin, deserialize_field, is_pointer_tag, name_to_pathname from .bumper_utils import bumperize from .transcripts_utils import ( diff --git a/xmodule/word_cloud_block.py b/xmodule/word_cloud_block.py index cf458a1c7a7d..5ce62e96eba6 100644 --- a/xmodule/word_cloud_block.py +++ b/xmodule/word_cloud_block.py @@ -18,7 +18,7 @@ from xmodule.editing_block import EditingMixin from xmodule.raw_block import EmptyDataRawMixin from xmodule.util.xmodule_django import add_webpack_to_fragment -from xmodule.xml_module import XmlMixin +from xmodule.xml_block import XmlMixin from xmodule.x_module import ( HTMLSnippet, ResourceTemplates, diff --git a/xmodule/xml_module.py b/xmodule/xml_block.py similarity index 100% rename from xmodule/xml_module.py rename to xmodule/xml_block.py From dd9f6936bc38b10c10ab7d68bb0243e005f45432 Mon Sep 17 00:00:00 2001 From: 0x29a Date: Wed, 26 Oct 2022 21:13:38 +0200 Subject: [PATCH 20/25] refactor: xmodule/video_module -> xmodule/video_block --- .../contentstore/tests/test_contentstore.py | 4 +- .../tests/test_transcripts_utils.py | 20 +++---- .../views/tests/test_course_index.py | 4 +- .../views/tests/test_transcripts.py | 40 +++++++------- .../contentstore/views/transcript_settings.py | 2 +- .../contentstore/views/transcripts_ajax.py | 12 ++--- cms/djangoapps/contentstore/views/videos.py | 2 +- cms/envs/bok_choy.py | 2 +- cms/envs/common.py | 2 +- cms/envs/devstack.py | 2 +- lms/djangoapps/branding/models.py | 4 +- .../course_api/blocks/tests/test_api.py | 2 +- .../tests/test_video_stream_priority.py | 6 +-- .../transformers/tests/test_video_urls.py | 6 +-- .../blocks/transformers/video_urls.py | 2 +- .../courseware/tests/test_module_render.py | 2 +- .../courseware/tests/test_video_handlers.py | 36 ++++++------- .../courseware/tests/test_video_mongo.py | 52 +++++++++---------- .../courseware/tests/test_video_xml.py | 2 +- lms/envs/common.py | 2 +- setup.py | 4 +- xmodule/fields.py | 4 +- .../test_cross_modulestore_import_export.py | 2 +- xmodule/modulestore/tests/test_mongo.py | 6 +-- xmodule/tests/test_export.py | 2 +- xmodule/tests/test_transcripts_utils.py | 2 +- xmodule/tests/test_video.py | 44 ++++++++-------- .../{video_module => video_block}/__init__.py | 4 +- .../bumper_utils.py | 0 .../transcripts_utils.py | 6 +-- .../video_block.py} | 6 +-- .../video_handlers.py | 6 +-- .../video_utils.py | 2 +- .../video_xfields.py | 6 +-- 34 files changed, 149 insertions(+), 149 deletions(-) rename xmodule/{video_module => video_block}/__init__.py (67%) rename xmodule/{video_module => video_block}/bumper_utils.py (100%) rename xmodule/{video_module => video_block}/transcripts_utils.py (99%) rename xmodule/{video_module/video_module.py => video_block/video_block.py} (99%) rename xmodule/{video_module => video_block}/video_handlers.py (99%) rename xmodule/{video_module => video_block}/video_utils.py (98%) rename xmodule/{video_module => video_block}/video_xfields.py (98%) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 847b4eeeec24..99ffec3ac6ab 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -38,7 +38,7 @@ from xmodule.modulestore.xml_exporter import export_course_to_xml from xmodule.modulestore.xml_importer import import_course_from_xml, perform_xlint from xmodule.seq_block import SequenceBlock -from xmodule.video_module import VideoBlock +from xmodule.video_block import VideoBlock from cms.djangoapps.contentstore.config import waffle from cms.djangoapps.contentstore.tests.utils import AjaxEnabledTestClient, CourseTestCase, get_url, parse_json @@ -403,7 +403,7 @@ def test_export_course_with_metadata_only_video(self): import_course_from_xml(self.store, self.user.id, TEST_DATA_DIR, ['toy'], create_if_not_present=True) course_id = self.store.make_course_key('edX', 'toy', '2012_Fall') - # create a new video module and add it as a child to a vertical + # create a new video block and add it as a child to a vertical # this re-creates a bug whereby since the video template doesn't have # anything in 'data' field, the export was blowing up verticals = self.store.get_items(course_id, qualifiers={'category': 'vertical'}) diff --git a/cms/djangoapps/contentstore/tests/test_transcripts_utils.py b/cms/djangoapps/contentstore/tests/test_transcripts_utils.py index 3f6af8512eee..69e327bf97ef 100644 --- a/cms/djangoapps/contentstore/tests/test_transcripts_utils.py +++ b/cms/djangoapps/contentstore/tests/test_transcripts_utils.py @@ -22,7 +22,7 @@ from xmodule.exceptions import NotFoundError # 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, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.video_module import transcripts_utils # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block import transcripts_utils # lint-amnesty, pylint: disable=wrong-import-order TEST_DATA_CONTENTSTORE = copy.deepcopy(settings.CONTENTSTORE) TEST_DATA_CONTENTSTORE['DOC_STORE_CONFIG']['db'] = 'test_xcontent_%s' % uuid4().hex @@ -234,7 +234,7 @@ def test_success_downloading_subs(self): self.clear_sub_content(good_youtube_sub) language_code = 'en' - with patch('xmodule.video_module.transcripts_utils.requests.get') as mock_get: + with patch('xmodule.video_block.transcripts_utils.requests.get') as mock_get: setup_caption_responses(mock_get, language_code, caption_response_string) transcripts_utils.download_youtube_subs(good_youtube_sub, self.course, settings) @@ -257,7 +257,7 @@ def test_subs_for_html5_vid_with_periods(self): self.assertEqual(html5_ids[2], 'baz.1.4') self.assertEqual(html5_ids[3], 'foo') - @patch('xmodule.video_module.transcripts_utils.requests.get') + @patch('xmodule.video_block.transcripts_utils.requests.get') def test_fail_downloading_subs(self, mock_get): track_status_code = 404 @@ -458,7 +458,7 @@ class TestYoutubeTranscripts(unittest.TestCase): """ Tests for checking right datastructure returning when using youtube api. """ - @patch('xmodule.video_module.transcripts_utils.requests.get') + @patch('xmodule.video_block.transcripts_utils.requests.get') def test_youtube_bad_status_code(self, mock_get): track_status_code = 404 setup_caption_responses(mock_get, 'en', 'test', track_status_code) @@ -466,7 +466,7 @@ def test_youtube_bad_status_code(self, mock_get): with self.assertRaises(transcripts_utils.GetTranscriptsFromYouTubeException): transcripts_utils.get_transcripts_from_youtube(youtube_id, settings, translation) - @patch('xmodule.video_module.transcripts_utils.requests.get') + @patch('xmodule.video_block.transcripts_utils.requests.get') def test_youtube_empty_text(self, mock_get): setup_caption_responses(mock_get, 'en', '') youtube_id = 'bad_youtube_id' @@ -489,7 +489,7 @@ def test_youtube_good_result(self): } youtube_id = 'good_youtube_id' language_code = 'en' - with patch('xmodule.video_module.transcripts_utils.requests.get') as mock_get: + with patch('xmodule.video_block.transcripts_utils.requests.get') as mock_get: setup_caption_responses(mock_get, language_code, caption_response_string) transcripts = transcripts_utils.get_transcripts_from_youtube(youtube_id, settings, translation) @@ -886,7 +886,7 @@ def test_get_transcript_from_content_store_for_ur(self): self.assertEqual(filename, 'ur_video_101.sjson') self.assertEqual(mimetype, self.sjson_mime_type) - @patch('xmodule.video_module.transcripts_utils.get_video_transcript_content') + @patch('xmodule.video_block.transcripts_utils.get_video_transcript_content') def test_get_transcript_from_val(self, mock_get_video_transcript_content): """ Verify that `get_transcript` function returns correct data when transcript is in val. @@ -948,7 +948,7 @@ def test_get_transcript_no_en_transcript(self): exception_message = str(no_en_transcript_exception.exception) self.assertEqual(exception_message, 'No transcript for `en` language') - @patch('xmodule.video_module.transcripts_utils.edxval_api.get_video_transcript_data') + @patch('xmodule.video_block.transcripts_utils.edxval_api.get_video_transcript_data') def test_get_transcript_incorrect_json_(self, mock_get_video_transcript_data): """ Verify that `get transcript` function returns a working json file if the original throws an error @@ -962,7 +962,7 @@ def test_get_transcript_incorrect_json_(self, mock_get_video_transcript_data): transcripts_utils.TranscriptsGenerationException, UnicodeDecodeError('aliencodec', b'\x02\x01', 1, 2, 'alien codec found!') ) - @patch('xmodule.video_module.transcripts_utils.Transcript') + @patch('xmodule.video_block.transcripts_utils.Transcript') def test_get_transcript_val_exceptions(self, exception_to_raise, mock_Transcript): """ Verify that `get_transcript_from_val` function raises `NotFoundError` when specified exceptions raised. @@ -982,7 +982,7 @@ def test_get_transcript_val_exceptions(self, exception_to_raise, mock_Transcript transcripts_utils.TranscriptsGenerationException, UnicodeDecodeError('aliencodec', b'\x02\x01', 1, 2, 'alien codec found!') ) - @patch('xmodule.video_module.transcripts_utils.Transcript') + @patch('xmodule.video_block.transcripts_utils.Transcript') def test_get_transcript_content_store_exceptions(self, exception_to_raise, mock_Transcript): """ Verify that `get_transcript_from_contentstore` function raises `NotFoundError` when specified exceptions raised. diff --git a/cms/djangoapps/contentstore/views/tests/test_course_index.py b/cms/djangoapps/contentstore/views/tests/test_course_index.py index a954a34632e6..36ed1aef0c81 100644 --- a/cms/djangoapps/contentstore/views/tests/test_course_index.py +++ b/cms/djangoapps/contentstore/views/tests/test_course_index.py @@ -769,7 +769,7 @@ def test_reindex_json_responses(self): course_id=str(self.course.id)) self.assertEqual(response['total'], 1) - @mock.patch('xmodule.video_module.VideoBlock.index_dictionary') + @mock.patch('xmodule.video_block.VideoBlock.index_dictionary') def test_reindex_video_error_json_responses(self, mock_index_dictionary): """ Test json response with mocked error data for video @@ -879,7 +879,7 @@ def test_indexing_responses(self): course_id=str(self.course.id)) self.assertEqual(response['total'], 1) - @mock.patch('xmodule.video_module.VideoBlock.index_dictionary') + @mock.patch('xmodule.video_block.VideoBlock.index_dictionary') def test_indexing_video_error_responses(self, mock_index_dictionary): """ Test do_course_reindex response with mocked error data for video diff --git a/cms/djangoapps/contentstore/views/tests/test_transcripts.py b/cms/djangoapps/contentstore/views/tests/test_transcripts.py index fd130917d2e4..07b5e52705bd 100644 --- a/cms/djangoapps/contentstore/views/tests/test_transcripts.py +++ b/cms/djangoapps/contentstore/views/tests/test_transcripts.py @@ -22,8 +22,8 @@ from xmodule.contentstore.django import contentstore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.exceptions import NotFoundError # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.video_module import VideoBlock # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.video_module.transcripts_utils import ( # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block import VideoBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block.transcripts_utils import ( # lint-amnesty, pylint: disable=wrong-import-order GetTranscriptsFromYouTubeException, Transcript, get_video_transcript_content, @@ -83,7 +83,7 @@ def setUp(self): """Create initial data.""" super().setUp() - # Add video module + # Add video block data = { 'parent_locator': str(self.course.location), 'category': 'video', @@ -121,9 +121,9 @@ def get_youtube_ids(self): 1.5: item.youtube_id_1_5 } - def create_non_video_module(self): + def create_non_video_block(self): """ - Setup non video module for tests. + Setup non video block for tests. """ data = { 'parent_locator': str(self.course.location), @@ -324,8 +324,8 @@ def test_transcript_upload_unknown_category(self): """ Test that transcript upload validation fails if item's category is other than video. """ - # non_video module setup - i.e. an item whose category is not 'video'. - usage_key = self.create_non_video_module() + # non_video block setup - i.e. an item whose category is not 'video'. + usage_key = self.create_non_video_block() # Request to upload transcript for the item response = self.upload_transcript(locator=usage_key, transcript_file=self.good_srt_file, edx_video_id='') self.assert_response( @@ -489,8 +489,8 @@ def test_choose_transcript_fails_on_unknown_category(self): """ Test that transcript choose validation fails if item's category is other than video. """ - # non_video module setup - i.e. an item whose category is not 'video'. - usage_key = self.create_non_video_module() + # non_video block setup - i.e. an item whose category is not 'video'. + usage_key = self.create_non_video_block() # Request to choose transcript for the item response = self.choose_transcript(locator=usage_key, chosen_html5_id=self.chosen_html5_id) self.assert_response( @@ -611,8 +611,8 @@ def test_rename_transcript_fails_on_unknown_category(self): """ Test that validation fails if item's category is other than video. """ - # non_video module setup - i.e. an item whose category is not 'video'. - usage_key = self.create_non_video_module() + # non_video block setup - i.e. an item whose category is not 'video'. + usage_key = self.create_non_video_block() # Make call to use current transcript from contentstore. response = self.rename_transcript(usage_key) self.assert_response( @@ -747,8 +747,8 @@ def test_replace_transcript_fails_on_unknown_category(self): """ Test that validation fails if item's category is other than video. """ - # non_video module setup - i.e. an item whose category is not 'video'. - usage_key = self.create_non_video_module() + # non_video block setup - i.e. an item whose category is not 'video'. + usage_key = self.create_non_video_block() response = self.replace_transcript(usage_key, youtube_id=self.youtube_id) self.assert_response( response, @@ -825,11 +825,11 @@ def test_download_transcript_404_with_bad_locator(self): response = self.download_transcript(locator='invalid-locator') self.assert_download_response(response, expected_status_code=404) - def test_download_transcript_404_for_non_video_module(self): + def test_download_transcript_404_for_non_video_block(self): """ - Verify that download transcript returns 404 for a non video module. + Verify that download transcript returns 404 for a non video block. """ - usage_key = self.create_non_video_module() + usage_key = self.create_non_video_block() response = self.download_transcript(locator=usage_key) self.assert_download_response(response, expected_status_code=404) @@ -940,7 +940,7 @@ def test_check_youtube(self): } ) - @patch('xmodule.video_module.transcripts_utils.requests.get') + @patch('xmodule.video_block.transcripts_utils.requests.get') def test_check_youtube_with_transcript_name(self, mock_get): """ Test that the transcripts are fetched correctly when the the transcript name is set @@ -1033,8 +1033,8 @@ def test_fail_data_with_bad_locator(self): self.assertEqual(resp.status_code, 400) self.assertEqual(json.loads(resp.content.decode('utf-8')).get('status'), "Can't find item by locator.") - def test_fail_for_non_video_module(self): - # Not video module: setup + def test_fail_for_non_video_block(self): + # Not video block: setup data = { 'parent_locator': str(self.course.location), 'category': 'problem', @@ -1080,7 +1080,7 @@ def test_fail_for_non_video_module(self): 'Transcripts are supported only for "video" modules.', ) - @patch('xmodule.video_module.transcripts_utils.get_video_transcript_content') + @patch('xmodule.video_block.transcripts_utils.get_video_transcript_content') def test_command_for_fallback_transcript(self, mock_get_video_transcript_content): """ Verify the command if a transcript is there in edx-val. diff --git a/cms/djangoapps/contentstore/views/transcript_settings.py b/cms/djangoapps/contentstore/views/transcript_settings.py index 677609404225..40846a2ec3c0 100644 --- a/cms/djangoapps/contentstore/views/transcript_settings.py +++ b/cms/djangoapps/contentstore/views/transcript_settings.py @@ -27,7 +27,7 @@ from openedx.core.djangoapps.video_config.models import VideoTranscriptEnabledFlag from openedx.core.djangoapps.video_pipeline.api import update_3rd_party_transcription_service_credentials from openedx.core.lib.api.view_utils import view_auth_classes -from xmodule.video_module.transcripts_utils import Transcript, TranscriptsGenerationException # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block.transcripts_utils import Transcript, TranscriptsGenerationException # lint-amnesty, pylint: disable=wrong-import-order from .videos import TranscriptProvider diff --git a/cms/djangoapps/contentstore/views/transcripts_ajax.py b/cms/djangoapps/contentstore/views/transcripts_ajax.py index cf322ff45ba2..a27ae4a4bf83 100644 --- a/cms/djangoapps/contentstore/views/transcripts_ajax.py +++ b/cms/djangoapps/contentstore/views/transcripts_ajax.py @@ -29,7 +29,7 @@ from xmodule.exceptions import NotFoundError # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.video_module.transcripts_utils import ( # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block.transcripts_utils import ( # lint-amnesty, pylint: disable=wrong-import-order GetTranscriptsFromYouTubeException, Transcript, TranscriptsGenerationException, @@ -124,9 +124,9 @@ def save_video_transcript(edx_video_id, input_format, transcript_content, langua return result -def validate_video_module(request, locator): +def validate_video_block(request, locator): """ - Validates video module given its locator and request. Also, checks + Validates video block given its locator and request. Also, checks if requesting user has course authoring access. Arguments: @@ -175,7 +175,7 @@ def validate_transcript_upload_data(request): error = _('Video ID is required.') if not error: - error, video = validate_video_module(request, video_locator) + error, video = validate_video_block(request, video_locator) if not error: validated_data.update({ 'video': video, @@ -250,7 +250,7 @@ def download_transcripts(request): Raises Http404 if unsuccessful. """ - error, video = validate_video_module(request, locator=request.GET.get('locator')) + error, video = validate_video_block(request, locator=request.GET.get('locator')) if error: raise Http404 @@ -491,7 +491,7 @@ def validate_transcripts_request(request, include_yt=False, include_html5=False) if not data: error = _('Incoming video data is empty.') else: - error, video = validate_video_module(request, locator=data.get('locator')) + error, video = validate_video_block(request, locator=data.get('locator')) if not error: validated_data.update({'video': video}) diff --git a/cms/djangoapps/contentstore/views/videos.py b/cms/djangoapps/contentstore/views/videos.py index d9de03a854a2..3631ff20d3cf 100644 --- a/cms/djangoapps/contentstore/views/videos.py +++ b/cms/djangoapps/contentstore/views/videos.py @@ -52,7 +52,7 @@ ) from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag from openedx.core.lib.api.view_utils import view_auth_classes -from xmodule.video_module.transcripts_utils import Transcript # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block.transcripts_utils import Transcript # lint-amnesty, pylint: disable=wrong-import-order from ..models import VideoUploadConfig from ..utils import reverse_course_url diff --git a/cms/envs/bok_choy.py b/cms/envs/bok_choy.py index 24236cc183d7..f96183840c71 100644 --- a/cms/envs/bok_choy.py +++ b/cms/envs/bok_choy.py @@ -57,7 +57,7 @@ default_store=os.environ.get('DEFAULT_STORE', 'draft'), ) -# Needed to enable licensing on video modules +# Needed to enable licensing on video blocks XBLOCK_SETTINGS.update({'VideoBlock': {'licensing_enabled': True}}) # Capture the console log via template includes, until webdriver supports log capture again diff --git a/cms/envs/common.py b/cms/envs/common.py index bcddb293e0cc..1d326f34cf76 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -1578,7 +1578,7 @@ # Monitor the status of services 'openedx.core.djangoapps.service_status', - # Video module configs (This will be moved to Video once it becomes an XBlock) + # Video block configs (This will be moved to Video once it becomes an XBlock) 'openedx.core.djangoapps.video_config', # edX Video Pipeline integration diff --git a/cms/envs/devstack.py b/cms/envs/devstack.py index 6bffbe300694..c03347ce9987 100644 --- a/cms/envs/devstack.py +++ b/cms/envs/devstack.py @@ -137,7 +137,7 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing ################################ COURSE LICENSES ################################ FEATURES['LICENSING'] = True -# Needed to enable licensing on video modules +# Needed to enable licensing on video blocks XBLOCK_SETTINGS.update({'VideoBlock': {'licensing_enabled': True}}) ################################ SEARCH INDEX ################################ diff --git a/lms/djangoapps/branding/models.py b/lms/djangoapps/branding/models.py index ee710847b9c3..d2df8174b0c2 100644 --- a/lms/djangoapps/branding/models.py +++ b/lms/djangoapps/branding/models.py @@ -1,8 +1,8 @@ """ -Model used by Video module for Branding configuration. +Model used by Video block for Branding configuration. Includes: - BrandingInfoConfig: A ConfigurationModel for managing how Video Module will + BrandingInfoConfig: A ConfigurationModel for managing how Video Block will use Branding. """ diff --git a/lms/djangoapps/course_api/blocks/tests/test_api.py b/lms/djangoapps/course_api/blocks/tests/test_api.py index f4cfe82f9c55..e6fd74463aa9 100644 --- a/lms/djangoapps/course_api/blocks/tests/test_api.py +++ b/lms/djangoapps/course_api/blocks/tests/test_api.py @@ -144,7 +144,7 @@ def setUp(self): self.request = RequestFactory().get("/dummy") self.request.user = self.user - @patch('xmodule.video_module.VideoBlock.student_view_data') + @patch('xmodule.video_block.VideoBlock.student_view_data') def test_video_urls_rewrite(self, video_data_patch): """ Verify the video blocks returned have their URL re-written for diff --git a/lms/djangoapps/course_api/blocks/transformers/tests/test_video_stream_priority.py b/lms/djangoapps/course_api/blocks/transformers/tests/test_video_stream_priority.py index 604f47306c53..d0aea73738d1 100644 --- a/lms/djangoapps/course_api/blocks/transformers/tests/test_video_stream_priority.py +++ b/lms/djangoapps/course_api/blocks/transformers/tests/test_video_stream_priority.py @@ -66,7 +66,7 @@ def collect_and_transform(self): @mock.patch('lms.djangoapps.course_blocks.usage_info.CourseUsageInfo') @mock.patch('openedx.core.djangoapps.waffle_utils.CourseWaffleFlag.is_enabled') - @mock.patch('xmodule.video_module.VideoBlock.student_view_data') + @mock.patch('xmodule.video_block.VideoBlock.student_view_data') def test_write_for_deprecated_youtube_flag_on(self, mock_video_data, deprecate_youtube_flag, usage_info): """ Test that video stream priority is written correctly with @@ -127,7 +127,7 @@ def test_write_for_deprecated_youtube_flag_on(self, mock_video_data, deprecate_y @mock.patch('lms.djangoapps.course_blocks.usage_info.CourseUsageInfo') @mock.patch('openedx.core.djangoapps.waffle_utils.CourseWaffleFlag.is_enabled') - @mock.patch('xmodule.video_module.VideoBlock.student_view_data') + @mock.patch('xmodule.video_block.VideoBlock.student_view_data') def test_write_for_deprecated_youtube_flag_off(self, mock_video_data, deprecate_youtube_flag, usage_info): """ Test that video stream priority is written correctly with @@ -186,7 +186,7 @@ def test_write_for_deprecated_youtube_flag_off(self, mock_video_data, deprecate_ else: assert post_transform_data[video_format] == fetched_stream_priority - @mock.patch('xmodule.video_module.VideoBlock.student_view_data') + @mock.patch('xmodule.video_block.VideoBlock.student_view_data') def test_no_priority_for_web_only_videos(self, mock_video_data): """ Verify no write attempt is made for the videos diff --git a/lms/djangoapps/course_api/blocks/transformers/tests/test_video_urls.py b/lms/djangoapps/course_api/blocks/transformers/tests/test_video_urls.py index 44c3536e1552..8a695ac84ab5 100644 --- a/lms/djangoapps/course_api/blocks/transformers/tests/test_video_urls.py +++ b/lms/djangoapps/course_api/blocks/transformers/tests/test_video_urls.py @@ -63,7 +63,7 @@ def collect_and_transform(self): block_structure=self.block_structure, ) - @mock.patch('xmodule.video_module.VideoBlock.student_view_data') + @mock.patch('xmodule.video_block.VideoBlock.student_view_data') def test_rewrite_for_encoded_videos(self, mock_video_data): """ Test that video URLs for videos with available encodings @@ -93,7 +93,7 @@ def test_rewrite_for_encoded_videos(self, mock_video_data): for video_format, video_url in post_transform_data.items(): assert pre_transform_data[video_format] != video_url - @mock.patch('xmodule.video_module.VideoBlock.student_view_data') + @mock.patch('xmodule.video_block.VideoBlock.student_view_data') def test_no_rewrite_for_third_party_vendor(self, mock_video_data): """ Test that video URLs aren't re-written for the videos @@ -123,7 +123,7 @@ def test_no_rewrite_for_third_party_vendor(self, mock_video_data): for video_format, video_url in post_transform_data.items(): assert pre_transform_data[video_format] == video_url - @mock.patch('xmodule.video_module.VideoBlock.student_view_data') + @mock.patch('xmodule.video_block.VideoBlock.student_view_data') def test_no_rewrite_for_web_only_videos(self, mock_video_data): """ Verify no rewrite attempt is made for the videos diff --git a/lms/djangoapps/course_api/blocks/transformers/video_urls.py b/lms/djangoapps/course_api/blocks/transformers/video_urls.py index 60e0f3ed82c9..974c7faf7133 100644 --- a/lms/djangoapps/course_api/blocks/transformers/video_urls.py +++ b/lms/djangoapps/course_api/blocks/transformers/video_urls.py @@ -6,7 +6,7 @@ from django.conf import settings from openedx.core.djangoapps.content.block_structure.transformer import BlockStructureTransformer -from xmodule.video_module.video_utils import rewrite_video_url # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block.video_utils import rewrite_video_url # lint-amnesty, pylint: disable=wrong-import-order from .student_view import StudentViewTransformer diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index 363de536d79f..4983a642c1a4 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -57,7 +57,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, ToyCourseFactory, check_mongo_calls # lint-amnesty, pylint: disable=wrong-import-order from xmodule.modulestore.tests.test_asides import AsideTestType # lint-amnesty, pylint: disable=wrong-import-order from xmodule.services import RebindUserServiceError -from xmodule.video_module import VideoBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block import VideoBlock # lint-amnesty, pylint: disable=wrong-import-order from xmodule.x_module import STUDENT_VIEW, CombinedSystem # lint-amnesty, pylint: disable=wrong-import-order from common.djangoapps import static_replace from common.djangoapps.course_modes.models import CourseMode # lint-amnesty, pylint: disable=reimported diff --git a/lms/djangoapps/courseware/tests/test_video_handlers.py b/lms/djangoapps/courseware/tests/test_video_handlers.py index 91ad34d0b504..d2a260bf86fc 100644 --- a/lms/djangoapps/courseware/tests/test_video_handlers.py +++ b/lms/djangoapps/courseware/tests/test_video_handlers.py @@ -22,8 +22,8 @@ from xmodule.exceptions import NotFoundError # lint-amnesty, pylint: disable=wrong-import-order 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.video_module import VideoBlock # lint-amnesty, pylint: disable=wrong-import-order -from xmodule.video_module.transcripts_utils import ( # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block import VideoBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.video_block.transcripts_utils import ( # lint-amnesty, pylint: disable=wrong-import-order Transcript, edxval_api, get_transcript, @@ -285,7 +285,7 @@ def test_available_translation_non_en(self): response = self.item.transcript(request=request, dispatch='available_translations') assert json.loads(response.body.decode('utf-8')) == ['uk'] - @patch('xmodule.video_module.transcripts_utils.get_video_transcript_content') + @patch('xmodule.video_block.transcripts_utils.get_video_transcript_content') def test_multiple_available_translations(self, mock_get_video_transcript_content): mock_get_video_transcript_content.return_value = { 'content': json.dumps({ @@ -311,8 +311,8 @@ def test_multiple_available_translations(self, mock_get_video_transcript_content response = self.item.transcript(request=request, dispatch='available_translations') assert sorted(json.loads(response.body.decode('utf-8'))) == sorted(['en', 'uk']) - @patch('xmodule.video_module.transcripts_utils.get_video_transcript_content') - @patch('xmodule.video_module.transcripts_utils.get_available_transcript_languages') + @patch('xmodule.video_block.transcripts_utils.get_video_transcript_content') + @patch('xmodule.video_block.transcripts_utils.get_available_transcript_languages') @ddt.data( ( ['en', 'uk', 'ro'], @@ -388,7 +388,7 @@ def test_val_available_translations( response = self.item.transcript(request=request, dispatch='available_translations') self.assertCountEqual(json.loads(response.body.decode('utf-8')), result) - @patch('xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages') + @patch('xmodule.video_block.transcripts_utils.edxval_api.get_available_transcript_languages') def test_val_available_translations_feature_disabled(self, mock_get_available_transcript_languages): """ Tests available translations with val transcript languages when feature is disabled. @@ -438,7 +438,7 @@ def test_available_translation_en_and_non_en(self, lang): response = self.item.transcript(request=request, dispatch=self.dispatch) assert json.loads(response.body.decode('utf-8')) == [lang] - @patch('xmodule.video_module.transcripts_utils.get_available_transcript_languages') + @patch('xmodule.video_block.transcripts_utils.get_available_transcript_languages') def test_multiple_available_translations(self, mock_get_transcript_languages): """ Verify that available translations dispatch works as expected for multiple @@ -498,7 +498,7 @@ def test_download_transcript_not_exist(self): assert response.status == '404 Not Found' @patch( - 'xmodule.video_module.video_handlers.get_transcript', + 'xmodule.video_block.video_handlers.get_transcript', return_value=('Subs!', 'test_filename.srt', 'application/x-subrip; charset=utf-8') ) def test_download_srt_exist(self, __): @@ -509,7 +509,7 @@ def test_download_srt_exist(self, __): assert response.headers['Content-Language'] == 'en' @patch( - 'xmodule.video_module.video_handlers.get_transcript', + 'xmodule.video_block.video_handlers.get_transcript', return_value=('Subs!', 'txt', 'text/plain; charset=utf-8') ) def test_download_txt_exist(self, __): @@ -528,7 +528,7 @@ def test_download_en_no_sub(self): get_transcript(self.item) @patch( - 'xmodule.video_module.transcripts_utils.get_transcript_for_video', + 'xmodule.video_block.transcripts_utils.get_transcript_for_video', return_value=(Transcript.SRT, "塞", 'Subs!') ) def test_download_non_en_non_ascii_filename(self, __): @@ -538,8 +538,8 @@ def test_download_non_en_non_ascii_filename(self, __): assert response.headers['Content-Type'] == 'application/x-subrip; charset=utf-8' assert response.headers['Content-Disposition'] == 'attachment; filename="en_塞.srt"' - @patch('xmodule.video_module.transcripts_utils.edxval_api.get_video_transcript_data') - @patch('xmodule.video_module.get_transcript', Mock(side_effect=NotFoundError)) + @patch('xmodule.video_block.transcripts_utils.edxval_api.get_video_transcript_data') + @patch('xmodule.video_block.get_transcript', Mock(side_effect=NotFoundError)) def test_download_fallback_transcript(self, mock_get_video_transcript_data): """ Verify val transcript is returned as a fallback if it is not found in the content store. @@ -778,7 +778,7 @@ def test_translation_static_transcript(self, url, dispatch, status_code, sub=Non if sub: assert ('Location', f'/static/dummy/static/subs_{sub}.srt.sjson') in response.headerlist - @patch('xmodule.video_module.VideoBlock.course_id', return_value='not_a_course_locator') + @patch('xmodule.video_block.VideoBlock.course_id', return_value='not_a_course_locator') def test_translation_static_non_course(self, __): """ Test that get_static_transcript short-circuits in the case of a non-CourseLocator. @@ -799,9 +799,9 @@ def _set_static_asset_path(self): with store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.course.id): store.update_item(self.course, self.user.id) - @patch('xmodule.video_module.transcripts_utils.edxval_api.get_video_transcript_data') - @patch('xmodule.video_module.VideoBlock.translation', Mock(side_effect=NotFoundError)) - @patch('xmodule.video_module.VideoBlock.get_static_transcript', Mock(return_value=Response(status=404))) + @patch('xmodule.video_block.transcripts_utils.edxval_api.get_video_transcript_data') + @patch('xmodule.video_block.VideoBlock.translation', Mock(side_effect=NotFoundError)) + @patch('xmodule.video_block.VideoBlock.get_static_transcript', Mock(return_value=Response(status=404))) def test_translation_fallback_transcript(self, mock_get_video_transcript_data): """ Verify that the val transcript is returned as a fallback, @@ -832,8 +832,8 @@ def test_translation_fallback_transcript(self, mock_get_video_transcript_data): for attribute, value in expected_headers.items(): assert response.headers[attribute] == value - @patch('xmodule.video_module.VideoBlock.translation', Mock(side_effect=NotFoundError)) - @patch('xmodule.video_module.VideoBlock.get_static_transcript', Mock(return_value=Response(status=404))) + @patch('xmodule.video_block.VideoBlock.translation', Mock(side_effect=NotFoundError)) + @patch('xmodule.video_block.VideoBlock.get_static_transcript', Mock(return_value=Response(status=404))) def test_translation_fallback_transcript_feature_disabled(self): """ Verify that val transcript is not returned when its feature is disabled. diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index ede041dc5e85..7fc2f21ee29c 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -41,9 +41,9 @@ from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_MODULESTORE, TEST_DATA_SPLIT_MODULESTORE from xmodule.tests.test_import import DummySystem from xmodule.tests.test_video import VideoBlockTestBase -from xmodule.video_module import VideoBlock, bumper_utils, video_utils -from xmodule.video_module.transcripts_utils import Transcript, save_to_store, subs_filename -from xmodule.video_module.video_module import EXPORT_IMPORT_COURSE_DIR, EXPORT_IMPORT_STATIC_DIR +from xmodule.video_block import VideoBlock, bumper_utils, video_utils +from xmodule.video_block.transcripts_utils import Transcript, save_to_store, subs_filename +from xmodule.video_block.video_block import EXPORT_IMPORT_COURSE_DIR, EXPORT_IMPORT_STATIC_DIR from xmodule.x_module import PUBLIC_VIEW, STUDENT_VIEW from common.djangoapps.xblock_django.constants import ATTR_KEY_REQUEST_COUNTRY_CODE @@ -794,8 +794,8 @@ def helper_get_html_with_edx_video_id(self, data): return context, expected_context # pylint: disable=invalid-name - @patch('xmodule.video_module.video_module.BrandingInfoConfig') - @patch('xmodule.video_module.video_module.rewrite_video_url') + @patch('xmodule.video_block.video_block.BrandingInfoConfig') + @patch('xmodule.video_block.video_block.rewrite_video_url') def test_get_html_cdn_source(self, mocked_get_video, mock_BrandingInfoConfig): """ Test if sources got from CDN @@ -1021,14 +1021,14 @@ def test_get_html_on_toggling_hls_feature(self, hls_feature_enabled, expected_va """ Verify val profiles on toggling HLS Playback feature. """ - with patch('xmodule.video_module.video_module.edxval_api.get_urls_for_profiles') as get_urls_for_profiles: + with patch('xmodule.video_block.video_block.edxval_api.get_urls_for_profiles') as get_urls_for_profiles: get_urls_for_profiles.return_value = { 'desktop_webm': 'https://webm.com/dw.webm', 'hls': 'https://hls.com/hls.m3u8', 'youtube': 'https://yt.com/?v=v0TFmdO4ZP0', 'desktop_mp4': 'https://mp4.com/dm.mp4' } - with patch('xmodule.video_module.video_module.HLSPlaybackEnabledFlag.feature_enabled') as feature_enabled: + with patch('xmodule.video_block.video_block.HLSPlaybackEnabledFlag.feature_enabled') as feature_enabled: feature_enabled.return_value = hls_feature_enabled video_xml = '' self.initialize_block(data=video_xml) @@ -1038,8 +1038,8 @@ def test_get_html_on_toggling_hls_feature(self, hls_feature_enabled, expected_va expected_val_profiles, ) - @patch('xmodule.video_module.video_module.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True)) - @patch('xmodule.video_module.video_module.edxval_api.get_urls_for_profiles') + @patch('xmodule.video_block.video_block.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True)) + @patch('xmodule.video_block.video_block.edxval_api.get_urls_for_profiles') def test_get_html_hls(self, get_urls_for_profiles): """ Verify that hls profile functionality works as expected. @@ -1094,7 +1094,7 @@ def test_html_student_public_view(self): context = self.item_descriptor.render(PUBLIC_VIEW).content assert '"saveStateEnabled": false' in context - @patch('xmodule.video_module.video_module.edxval_api.get_course_video_image_url') + @patch('xmodule.video_block.video_block.edxval_api.get_course_video_image_url') def test_poster_image(self, get_course_video_image_url): """ Verify that poster image functionality works as expected. @@ -1107,7 +1107,7 @@ def test_poster_image(self, get_course_video_image_url): assert '"poster": "/media/video-images/poster.png"' in context - @patch('xmodule.video_module.video_module.edxval_api.get_course_video_image_url') + @patch('xmodule.video_block.video_block.edxval_api.get_course_video_image_url') def test_poster_image_without_edx_video_id(self, get_course_video_image_url): """ Verify that poster image is set to None and there is no crash when no edx_video_id. @@ -1120,7 +1120,7 @@ def test_poster_image_without_edx_video_id(self, get_course_video_image_url): assert "'poster': 'null'" in context - @patch('xmodule.video_module.video_module.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=False)) + @patch('xmodule.video_block.video_block.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=False)) def test_hls_primary_playback_on_toggling_hls_feature(self): """ Verify that `prioritize_hls` is set to `False` if `HLSPlaybackEnabledFlag` is disabled. @@ -1167,7 +1167,7 @@ def test_hls_primary_playback_on_toggling_hls_feature(self): 'result': 'false' }, ) - @patch('xmodule.video_module.video_module.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True)) + @patch('xmodule.video_block.video_block.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True)) def test_deprecate_youtube_course_waffle_flag(self, data): """ Tests various combinations of a `prioritize_hls` flag being set in waffle and overridden for a course. @@ -1228,7 +1228,7 @@ def setUp(self): ), ) @ddt.unpack - @patch('xmodule.video_module.video_module.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True)) + @patch('xmodule.video_block.video_block.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True)) def test_val_encoding_in_context(self, val_video_encodings, video_url): """ Tests that the val encodings correctly override the video url when the edx video id is set and @@ -1240,7 +1240,7 @@ def test_val_encoding_in_context(self, val_video_encodings, video_url): a video component is initialized. Current implementation considers this youtube source as a valid external youtube source. """ - with patch('xmodule.video_module.video_module.edxval_api.get_urls_for_profiles') as get_urls_for_profiles: + with patch('xmodule.video_block.video_block.edxval_api.get_urls_for_profiles') as get_urls_for_profiles: get_urls_for_profiles.return_value = val_video_encodings self.initialize_block( data='' @@ -1269,7 +1269,7 @@ def test_val_encoding_in_context(self, val_video_encodings, video_url): ), ) @ddt.unpack - @patch('xmodule.video_module.video_module.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True)) + @patch('xmodule.video_block.video_block.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True)) def test_val_encoding_in_context_without_external_youtube_source(self, val_video_encodings, video_url): """ Tests that the val encodings correctly override the video url when the edx video id is set and @@ -1277,7 +1277,7 @@ def test_val_encoding_in_context_without_external_youtube_source(self, val_video Accepted order of source priority is: VAL's youtube source > external youtube source > hls > mp4 > webm. """ - with patch('xmodule.video_module.video_module.edxval_api.get_urls_for_profiles') as get_urls_for_profiles: + with patch('xmodule.video_block.video_block.edxval_api.get_urls_for_profiles') as get_urls_for_profiles: get_urls_for_profiles.return_value = val_video_encodings # pylint: disable=line-too-long self.initialize_block( @@ -1346,7 +1346,7 @@ def test_editor_saved_when_youtube_and_html5_subs_exist(self, default_store): assert isinstance(Transcript.get_asset(item.location, self.file_name), StaticContent) assert isinstance(Transcript.get_asset(item.location, 'subs_video.srt.sjson'), StaticContent) old_metadata = own_metadata(item) - with patch('xmodule.video_module.video_module.manage_video_subtitles_save') as manage_video_subtitles_save: + with patch('xmodule.video_block.video_block.manage_video_subtitles_save') as manage_video_subtitles_save: item.editor_saved(self.user, old_metadata, None) assert not manage_video_subtitles_save.called @@ -1365,14 +1365,14 @@ def test_editor_saved_with_unstripped_video_id(self, default_store): item = self.store.get_item(self.item_descriptor.location) assert item.edx_video_id == unstripped_video_id - # Now, modifying and saving the video module should strip the video id. + # Now, modifying and saving the video block should strip the video id. old_metadata = own_metadata(item) item.display_name = 'New display name' item.editor_saved(self.user, old_metadata, None) assert item.edx_video_id == stripped_video_id @ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split) - @patch('xmodule.video_module.video_module.edxval_api.get_url_for_profile', Mock(return_value='test_yt_id')) + @patch('xmodule.video_block.video_block.edxval_api.get_url_for_profile', Mock(return_value='test_yt_id')) def test_editor_saved_with_yt_val_profile(self, default_store): """ Verify editor saved overrides `youtube_id_1_0` when a youtube val profile is there @@ -1572,7 +1572,7 @@ def test_with_edx_video_id_video_not_in_val(self, allow_cache_miss): ({'uk': 1, 'de': 1}, 'en-subs', ['de', 'en'], ['en', 'uk', 'de']), ) @ddt.unpack - @patch('xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages') + @patch('xmodule.video_block.transcripts_utils.edxval_api.get_available_transcript_languages') def test_student_view_with_val_transcripts_enabled(self, transcripts, english_sub, val_transcripts, expected_transcripts, mock_get_transcript_languages): """ @@ -1730,7 +1730,7 @@ def test_export_val_transcripts_backward_compatibility(self, languages, sub, exp content=ContentFile(TRANSCRIPT_FILE_SRT_DATA) ) - # Export the video module into xml + # Export the video block into xml video_xml = self.descriptor.definition_to_xml(resource_fs=self.file_system) # Assert `sub` and `transcripts` attribute in the xml @@ -1767,7 +1767,7 @@ def test_export_val_data_not_found(self): expected = etree.XML(expected_str, parser=parser) self.assertXmlEqual(expected, actual) - @patch('xmodule.video_module.transcripts_utils.get_video_ids_info') + @patch('xmodule.video_block.transcripts_utils.get_video_ids_info') def test_export_no_video_ids(self, mock_get_video_ids_info): """ Tests export when there is no video id. `export_to_xml` only works in case of video id. @@ -2127,7 +2127,7 @@ class TestVideoWithBumper(TestVideo): # pylint: disable=test-inherits-tests # Use temporary FEATURES in this test without affecting the original FEATURES = dict(settings.FEATURES) - @patch('xmodule.video_module.bumper_utils.get_bumper_settings') + @patch('xmodule.video_block.bumper_utils.get_bumper_settings') def test_is_bumper_enabled(self, get_bumper_settings): """ Check that bumper is (not)shown if ENABLE_VIDEO_BUMPER is (False)True @@ -2151,8 +2151,8 @@ def test_is_bumper_enabled(self, get_bumper_settings): with override_settings(FEATURES=self.FEATURES): assert not bumper_utils.is_bumper_enabled(self.item_descriptor) - @patch('xmodule.video_module.bumper_utils.is_bumper_enabled') - @patch('xmodule.video_module.bumper_utils.get_bumper_settings') + @patch('xmodule.video_block.bumper_utils.is_bumper_enabled') + @patch('xmodule.video_block.bumper_utils.get_bumper_settings') @patch('edxval.api.get_urls_for_profiles') def test_bumper_metadata(self, get_url_for_profiles, get_bumper_settings, is_bumper_enabled): """ diff --git a/lms/djangoapps/courseware/tests/test_video_xml.py b/lms/djangoapps/courseware/tests/test_video_xml.py index 046c564b416e..4e84168bda28 100644 --- a/lms/djangoapps/courseware/tests/test_video_xml.py +++ b/lms/djangoapps/courseware/tests/test_video_xml.py @@ -16,7 +16,7 @@ from django.test import TestCase -from xmodule.video_module import VideoBlock +from xmodule.video_block import VideoBlock SOURCE_XML = """