refactor: xmodule/seq_module.py -> xmodule/seq_block.py

This commit is contained in:
0x29a
2022-10-26 21:08:07 +02:00
committed by Piotr Surowiec
parent e443e253df
commit 70019bac04
20 changed files with 37 additions and 37 deletions

View File

@@ -17,7 +17,7 @@ from xblock.fields import ReferenceList, Scope, String
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

View File

@@ -23,7 +23,7 @@ from xmodule import course_metadata_utils
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

View File

@@ -8,7 +8,7 @@ from lxml import etree
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,

View File

@@ -615,7 +615,7 @@ class SequenceBlock(
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)

View File

@@ -20,7 +20,7 @@ from xblock.fields import Integer, ReferenceValueDict, Scope, String
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

View File

@@ -26,7 +26,7 @@ from xmodule.html_block import AboutBlock, CourseInfoBlock, HtmlBlock, StaticTab
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

View File

@@ -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 = "<class 'xmodule.seq_module.SequenceBlock'>"
vc_str = "<class 'xmodule.seq_block.SequenceBlock'>"
assert str(vc) == vc_str

View File

@@ -18,7 +18,7 @@ from web_fragments.fragment import Fragment
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 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
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 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
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 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
)
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 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
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 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
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 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
"""
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 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
"""
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 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
"""
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 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
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)

View File

@@ -15,7 +15,7 @@ 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 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

View File

@@ -16,7 +16,7 @@ from xblock.fields import Boolean, Scope
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