refactor: xmodule/html_module.py -> xmodule/html_block.py

This commit is contained in:
0x29a
2022-10-26 21:04:42 +02:00
committed by Piotr Surowiec
parent 4d8618517f
commit 007e02cd76
22 changed files with 89 additions and 89 deletions

View File

@@ -20,7 +20,7 @@ from django.http import HttpResponseBadRequest
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

View File

@@ -71,7 +71,7 @@ class BackfillCourseOutlinesTest(SharedModuleStoreTestCase):
ItemFactory.create(
parent=unit,
category="html",
display_name="An HTML Module"
display_name="An HTML Block"
)
def test_end_to_end(self):

View File

@@ -283,14 +283,14 @@ class ImportRequiredTestCases(ContentStoreTestCase):
# 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 @@ class ImportRequiredTestCases(ContentStoreTestCase):
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('<p style="font:italic bold 72px/30px Georgia, serif; color: red; ">', html_module.data)
html_block = self.store.get_item(course_id.make_usage_key('html', 'with_styling'))
self.assertIn('<p style="font:italic bold 72px/30px Georgia, serif; color: red; ">', html_block.data)
# get the sample HTML with just a simple <img> tag information
html_module = self.store.get_item(course_id.make_usage_key('html', 'just_img'))
self.assertIn('<img src="/static/foo_bar.jpg" />', html_module.data)
html_block = self.store.get_item(course_id.make_usage_key('html', 'just_img'))
self.assertIn('<img src="/static/foo_bar.jpg" />', html_block.data)
def test_export_course_without_content_store(self):
# Create toy course

View File

@@ -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

View File

@@ -56,7 +56,7 @@ class TestOrphanBase(CourseTestCase):
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)

View File

@@ -192,15 +192,15 @@ class CourseTestCase(ProceduralCourseTestMixin, ModuleStoreTestCase):
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 @@ class CourseTestCase(ProceduralCourseTestMixin, ModuleStoreTestCase):
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

View File

@@ -728,7 +728,7 @@ class TestCourseReIndex(CourseTestCase):
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 @@ class TestCourseReIndex(CourseTestCase):
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 @@ class TestCourseReIndex(CourseTestCase):
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

View File

@@ -44,7 +44,7 @@ from xmodule.capa.tests.response_xml_factory import OptionResponseXMLFactory #
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

View File

@@ -209,15 +209,15 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
{
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
{
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
{
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
{
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
{
"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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
},
'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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
},
'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 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
"""
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):

View File

@@ -64,7 +64,7 @@ from openedx.core.djangolib.markup import HTML, Text
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

View File

@@ -16,7 +16,7 @@ from common.djangoapps.student.tests.factories import UserFactory # pylint: dis
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

View File

@@ -23,14 +23,14 @@ class LmsUtilsTest(ModuleStoreTestCase):
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 @@ class LmsUtilsTest(ModuleStoreTestCase):
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 @@ class LmsUtilsTest(ModuleStoreTestCase):
"""
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)

View File

@@ -47,14 +47,14 @@ class LmsXBlockMixinTestCase(ModuleStoreTestCase):
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 @@ class XBlockValidationTest(LmsXBlockMixinTestCase):
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],

View File

@@ -84,7 +84,7 @@ class UpdateDiscussionsSettingsFromCourseTestCase(ModuleStoreTestCase, Discussio
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 @@ class UpdateDiscussionsSettingsFromCourseTestCase(ModuleStoreTestCase, Discussio
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

View File

@@ -5,20 +5,20 @@ Setup script for the Open edX package.
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 @@ XBLOCKS = [
"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",

View File

@@ -210,7 +210,7 @@ class HtmlBlockMixin( # lint-amnesty, pylint: disable=abstract-method
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),

View File

@@ -22,7 +22,7 @@ from path import Path as path
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

View File

@@ -10,7 +10,7 @@ from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
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 = '''
<html>
<p>Hello World!</p>
@@ -156,7 +156,7 @@ class HtmlBlockIndexingTestCase(unittest.TestCase):
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 = '''
<html>
<p>This has CDATA in it.</p>
@@ -167,7 +167,7 @@ class HtmlBlockIndexingTestCase(unittest.TestCase):
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 = '''
<html>
<p> Text has spaces :) </p>
@@ -177,7 +177,7 @@ class HtmlBlockIndexingTestCase(unittest.TestCase):
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 = '''
<html>
<p>This has HTML comment in it.</p>
@@ -187,7 +187,7 @@ class HtmlBlockIndexingTestCase(unittest.TestCase):
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 = '''
<html>
<!-- Beginning of the html -->
@@ -202,7 +202,7 @@ class HtmlBlockIndexingTestCase(unittest.TestCase):
{'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 = '''
<html>
<style>p {color: green;}</style>

View File

@@ -463,7 +463,7 @@ class TestLibraryContentBlockWithSearchIndex(LibraryContentBlockTestMixin, Libra
@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):
"""

View File

@@ -17,8 +17,8 @@ dummy_render = lambda block, _: Fragment(block.data) # pylint: disable=invalid-
@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):
"""

View File

@@ -167,7 +167,7 @@ class SplitTestBlockLMSTest(SplitTestBlockTest):
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.

View File

@@ -202,7 +202,7 @@ class XmlMixin:
"""
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