diff --git a/xmodule/tests/__init__.py b/xmodule/tests/__init__.py
index e31aee0216..2a903f6f04 100644
--- a/xmodule/tests/__init__.py
+++ b/xmodule/tests/__init__.py
@@ -191,7 +191,7 @@ def prepare_block_runtime(
add_get_block=False,
):
"""
- Sets properties in the runtime of the specified descriptor that is
+ Sets properties in the runtime of the specified block that is
required for tests.
"""
diff --git a/xmodule/tests/test_capa_block.py b/xmodule/tests/test_capa_block.py
index 2e14b2b1c9..b13aae0839 100644
--- a/xmodule/tests/test_capa_block.py
+++ b/xmodule/tests/test_capa_block.py
@@ -2492,22 +2492,22 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
""")
- def _create_descriptor(self, xml, name=None):
+ def _create_block(self, xml, name=None):
""" Creates a ProblemBlock to run test against """
- descriptor = CapaFactory.create()
- descriptor.data = xml
+ block = CapaFactory.create()
+ block.data = xml
if name:
- descriptor.display_name = name
- return descriptor
+ block.display_name = name
+ return block
@ddt.data(*sorted(responsetypes.registry.registered_tags()))
def test_all_response_types(self, response_tag):
""" Tests that every registered response tag is correctly returned """
xml = "<{response_tag}>{response_tag}>".format(response_tag=response_tag)
name = "Some Capa Problem"
- descriptor = self._create_descriptor(xml, name=name)
- assert descriptor.problem_types == {response_tag}
- assert descriptor.index_dictionary() ==\
+ block = self._create_block(xml, name=name)
+ assert block.problem_types == {response_tag}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': [response_tag],
'content': {'display_name': name, 'capa_content': ''}}
@@ -2528,9 +2528,9 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
""")
name = "Test Capa Problem"
- descriptor = self._create_descriptor(xml, name=name)
- assert descriptor.problem_types == {'multiplechoiceresponse'}
- assert descriptor.index_dictionary() ==\
+ block = self._create_block(xml, name=name)
+ assert block.problem_types == {'multiplechoiceresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['multiplechoiceresponse'],
'content': {'display_name': name, 'capa_content': ' Label Some comment Apple Banana Chocolate Donut '}}
@@ -2556,14 +2556,14 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
""")
name = "Other Test Capa Problem"
- descriptor = self._create_descriptor(xml, name=name)
- assert descriptor.problem_types == {'multiplechoiceresponse', 'optionresponse'}
+ block = self._create_block(xml, name=name)
+ assert block.problem_types == {'multiplechoiceresponse', 'optionresponse'}
# We are converting problem_types to a set to compare it later without taking into account the order
# the reasoning behind is that the problem_types (property) is represented by dict and when it is converted
# to list its ordering is different everytime.
- indexing_result = descriptor.index_dictionary()
+ indexing_result = block.index_dictionary()
indexing_result['problem_types'] = set(indexing_result['problem_types'])
self.assertDictEqual(
indexing_result, {
@@ -2608,15 +2608,15 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
""")
name = "Blank Common Capa Problem"
- descriptor = self._create_descriptor(xml, name=name)
- assert descriptor.index_dictionary() ==\
+ block = self._create_block(xml, name=name)
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': [],
'content': {'display_name': name, 'capa_content': ' '}}
def test_indexing_checkboxes(self):
name = "Checkboxes"
- descriptor = self._create_descriptor(self.sample_checkbox_problem_xml, name=name)
+ block = self._create_block(self.sample_checkbox_problem_xml, name=name)
capa_content = textwrap.dedent("""
Title
Description
@@ -2629,30 +2629,30 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
Hungarian
Note: Make sure you select all of the correct options—there may be more than one!
""")
- assert descriptor.problem_types == {'choiceresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'choiceresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['choiceresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
def test_indexing_dropdown(self):
name = "Dropdown"
- descriptor = self._create_descriptor(self.sample_dropdown_problem_xml, name=name)
+ block = self._create_block(self.sample_dropdown_problem_xml, name=name)
capa_content = textwrap.dedent("""
Dropdown problems allow learners to select only one option from a list of options.
Description
You can use the following example problem as a model.
Which of the following countries celebrates its independence on August 15? 'India','Spain','China','Bermuda'
""")
- assert descriptor.problem_types == {'optionresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'optionresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['optionresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
def test_indexing_multiple_choice(self):
name = "Multiple Choice"
- descriptor = self._create_descriptor(self.sample_multichoice_problem_xml, name=name)
+ block = self._create_block(self.sample_multichoice_problem_xml, name=name)
capa_content = textwrap.dedent("""
Multiple choice problems allow learners to select only one option.
When you add the problem, be sure to select Settings to specify a Display Name and other values.
@@ -2663,15 +2663,15 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
Indonesia
Russia
""")
- assert descriptor.problem_types == {'multiplechoiceresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'multiplechoiceresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['multiplechoiceresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
def test_indexing_numerical_input(self):
name = "Numerical Input"
- descriptor = self._create_descriptor(self.sample_numerical_input_problem_xml, name=name)
+ block = self._create_block(self.sample_numerical_input_problem_xml, name=name)
capa_content = textwrap.dedent("""
In a numerical input problem, learners enter numbers or a specific and relatively simple mathematical
expression. Learners enter the response in plain text, and the system then converts the text to a symbolic
@@ -2685,15 +2685,15 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
How many miles away from Earth is the sun? Use scientific notation to answer.
The square of what number is -100?
""")
- assert descriptor.problem_types == {'numericalresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'numericalresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['numericalresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
def test_indexing_text_input(self):
name = "Text Input"
- descriptor = self._create_descriptor(self.sample_text_input_problem_xml, name=name)
+ block = self._create_block(self.sample_text_input_problem_xml, name=name)
capa_content = textwrap.dedent("""
In text input problems, also known as "fill-in-the-blank" problems, learners enter text into a response
field. The text can include letters and characters such as punctuation marks. The text that the learner
@@ -2704,8 +2704,8 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
You can use the following example problem as a model.
What was the first post-secondary school in China to allow both male and female students?
""")
- assert descriptor.problem_types == {'stringresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'stringresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['stringresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
@@ -2718,15 +2718,15 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
""")
name = "Non latin Input"
- descriptor = self._create_descriptor(sample_text_input_problem_xml, name=name)
+ block = self._create_block(sample_text_input_problem_xml, name=name)
capa_content = " Δοκιμή με μεταβλητές με Ελληνικούς χαρακτήρες μέσα σε python: $FX1_VAL "
- descriptor_dict = descriptor.index_dictionary()
- assert descriptor_dict['content']['capa_content'] == smart_str(capa_content)
+ block_dict = block.index_dictionary()
+ assert block_dict['content']['capa_content'] == smart_str(capa_content)
def test_indexing_checkboxes_with_hints_and_feedback(self):
name = "Checkboxes with Hints and Feedback"
- descriptor = self._create_descriptor(self.sample_checkboxes_with_hints_and_feedback_problem_xml, name=name)
+ block = self._create_block(self.sample_checkboxes_with_hints_and_feedback_problem_xml, name=name)
capa_content = textwrap.dedent("""
You can provide feedback for each option in a checkbox problem, with distinct feedback depending on
whether or not the learner selects that option.
@@ -2742,15 +2742,15 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
potato
tomato
""")
- assert descriptor.problem_types == {'choiceresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'choiceresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['choiceresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
def test_indexing_dropdown_with_hints_and_feedback(self):
name = "Dropdown with Hints and Feedback"
- descriptor = self._create_descriptor(self.sample_dropdown_with_hints_and_feedback_problem_xml, name=name)
+ block = self._create_block(self.sample_dropdown_with_hints_and_feedback_problem_xml, name=name)
capa_content = textwrap.dedent("""
You can provide feedback for each available option in a dropdown problem.
You can also add hints for learners.
@@ -2762,15 +2762,15 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
potato
tomato
""")
- assert descriptor.problem_types == {'optionresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'optionresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['optionresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
def test_indexing_multiple_choice_with_hints_and_feedback(self):
name = "Multiple Choice with Hints and Feedback"
- descriptor = self._create_descriptor(self.sample_multichoice_with_hints_and_feedback_problem_xml, name=name)
+ block = self._create_block(self.sample_multichoice_with_hints_and_feedback_problem_xml, name=name)
capa_content = textwrap.dedent("""
You can provide feedback for each option in a multiple choice problem.
You can also add hints for learners.
@@ -2782,15 +2782,15 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
potato
tomato
""")
- assert descriptor.problem_types == {'multiplechoiceresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'multiplechoiceresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['multiplechoiceresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
def test_indexing_numerical_input_with_hints_and_feedback(self):
name = "Numerical Input with Hints and Feedback"
- descriptor = self._create_descriptor(self.sample_numerical_input_with_hints_and_feedback_problem_xml, name=name)
+ block = self._create_block(self.sample_numerical_input_with_hints_and_feedback_problem_xml, name=name)
capa_content = textwrap.dedent("""
You can provide feedback for correct answers in numerical input problems. You cannot provide feedback
for incorrect answers.
@@ -2800,15 +2800,15 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
Use the following example problem as a model.
What is the arithmetic mean for the following set of numbers? (1, 5, 6, 3, 5)
""")
- assert descriptor.problem_types == {'numericalresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'numericalresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['numericalresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
def test_indexing_text_input_with_hints_and_feedback(self):
name = "Text Input with Hints and Feedback"
- descriptor = self._create_descriptor(self.sample_text_input_with_hints_and_feedback_problem_xml, name=name)
+ block = self._create_block(self.sample_text_input_with_hints_and_feedback_problem_xml, name=name)
capa_content = textwrap.dedent("""
You can provide feedback for the correct answer in text input problems, as well as for specific
incorrect answers.
@@ -2818,8 +2818,8 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
Use the following example problem as a model.
Which U.S. state has the largest land area?
""")
- assert descriptor.problem_types == {'stringresponse'}
- assert descriptor.index_dictionary() ==\
+ assert block.problem_types == {'stringresponse'}
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': ['stringresponse'],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
@@ -2840,12 +2840,12 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
""")
name = "Mixed business"
- descriptor = self._create_descriptor(sample_problem_xml, name=name)
+ block = self._create_block(sample_problem_xml, name=name)
capa_content = textwrap.dedent("""
This has HTML comment in it.
HTML end.
""")
- assert descriptor.index_dictionary() ==\
+ assert block.index_dictionary() ==\
{'content_type': ProblemBlock.INDEX_CONTENT_TYPE,
'problem_types': [],
'content': {'display_name': name, 'capa_content': capa_content.replace('\n', ' ')}}
@@ -2860,7 +2860,7 @@ class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=m
'
- return descriptor
+ block = ProblemBlock(get_test_system(), scope_ids=scope_ids)
+ block.runtime = Mock()
+ block.data = ''
+ return block
def test_generate_report_data_not_implemented(self):
scope_ids = Mock(block_type='noproblem')
- descriptor = ProblemBlock(get_test_system(), scope_ids=scope_ids)
+ block = ProblemBlock(get_test_system(), scope_ids=scope_ids)
with pytest.raises(NotImplementedError):
- next(descriptor.generate_report_data(iter([])))
+ next(block.generate_report_data(iter([])))
def test_generate_report_data_limit_responses(self):
- descriptor = self._get_descriptor()
- report_data = list(descriptor.generate_report_data(self._mock_user_state_generator(), 2))
+ block = self._get_block()
+ report_data = list(block.generate_report_data(self._mock_user_state_generator(), 2))
assert 2 == len(report_data)
def test_generate_report_data_dont_limit_responses(self):
- descriptor = self._get_descriptor()
+ block = self._get_block()
user_count = 5
response_count = 10
- report_data = list(descriptor.generate_report_data(
+ report_data = list(block.generate_report_data(
self._mock_user_state_generator(
user_count=user_count,
response_count=response_count,
@@ -3257,17 +3257,17 @@ class ProblemBlockReportGenerationTest(unittest.TestCase):
assert (user_count * response_count) == len(report_data)
def test_generate_report_data_skip_dynamath(self):
- descriptor = self._get_descriptor()
+ block = self._get_block()
iterator = iter([self._user_state(suffix='_dynamath')])
- report_data = list(descriptor.generate_report_data(iterator))
+ report_data = list(block.generate_report_data(iterator))
assert 0 == len(report_data)
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()
+ block = self._get_block()
with patch('xmodule.capa_block.LoncapaProblem') as mock_LoncapaProblem:
mock_LoncapaProblem.side_effect = LoncapaProblemError
- report_data = list(descriptor.generate_report_data(
+ report_data = list(block.generate_report_data(
self._mock_user_state_generator(
user_count=1,
response_count=5,
diff --git a/xmodule/tests/test_conditional.py b/xmodule/tests/test_conditional.py
index 0413842557..81eecd0938 100644
--- a/xmodule/tests/test_conditional.py
+++ b/xmodule/tests/test_conditional.py
@@ -67,33 +67,33 @@ class ConditionalFactory:
if the source_is_error_block flag is set, create a real ErrorBlock for the source.
"""
- # construct source descriptor and module:
+ # construct source block and module:
source_location = BlockUsageLocator(CourseLocator("edX", "conditional_test", "test_run", deprecated=True),
"problem", "SampleProblem", deprecated=True)
if source_is_error_block:
- # Make an error descriptor and block
- source_descriptor = ErrorBlock.from_xml(
+ # Make an error block
+ source_block = ErrorBlock.from_xml(
'some random xml data',
system,
id_generator=CourseLocationManager(source_location.course_key),
error_msg='random error message'
)
else:
- source_descriptor = Mock(name='source_descriptor')
- source_descriptor.location = source_location
+ source_block = Mock(name='source_block')
+ source_block.location = source_location
- source_descriptor.visible_to_staff_only = source_visible_to_staff_only
- source_descriptor.runtime = system
- source_descriptor.render = lambda view, context=None: system.render(source_descriptor, view, context)
+ source_block.visible_to_staff_only = source_visible_to_staff_only
+ source_block.runtime = system
+ source_block.render = lambda view, context=None: system.render(source_block, view, context)
- # construct other descriptors:
- child_descriptor = Mock(name='child_descriptor')
- child_descriptor.visible_to_staff_only = False
- child_descriptor._xmodule.student_view.return_value = Fragment(content='
This is a secret
') # lint-amnesty, pylint: disable=protected-access
- child_descriptor.student_view = child_descriptor._xmodule.student_view # lint-amnesty, pylint: disable=protected-access
- child_descriptor.runtime = system
- child_descriptor.render = lambda view, context=None: system.render(child_descriptor, view, context)
- child_descriptor.location = source_location.replace(category='html', name='child')
+ # construct other blocks:
+ child_block = Mock(name='child_block')
+ child_block.visible_to_staff_only = False
+ child_block._xmodule.student_view.return_value = Fragment(content='This is a secret
') # lint-amnesty, pylint: disable=protected-access
+ child_block.student_view = child_block._xmodule.student_view # lint-amnesty, pylint: disable=protected-access
+ child_block.runtime = system
+ child_block.render = lambda view, context=None: system.render(child_block, view, context)
+ child_block.location = source_location.replace(category='html', name='child')
def visible_to_nonstaff_users(desc):
"""
@@ -104,8 +104,8 @@ class ConditionalFactory:
def load_item(usage_id, for_parent=None): # pylint: disable=unused-argument
"""Test-only implementation of load_item that simply returns static xblocks."""
return {
- child_descriptor.location: child_descriptor,
- source_location: source_descriptor
+ child_block.location: child_block,
+ source_location: source_block
}.get(usage_id)
system.load_item = load_item
@@ -118,23 +118,23 @@ class ConditionalFactory:
'conditional_attr': 'attempted',
'conditional_value': 'true',
'xml_attributes': {'attempted': 'true'},
- 'children': [child_descriptor.location],
+ 'children': [child_block.location],
})
- cond_descriptor = ConditionalBlock(
+ cond_block = ConditionalBlock(
system,
field_data,
ScopeIds(None, None, cond_location, cond_location)
)
system.get_block_for_descriptor = lambda desc: desc if visible_to_nonstaff_users(desc) else None
- cond_descriptor.get_required_blocks = [
- system.get_block_for_descriptor(source_descriptor),
+ cond_block.get_required_blocks = [
+ system.get_block_for_descriptor(source_block),
]
# return dict:
- return {'cond_block': cond_descriptor,
- 'source_block': source_descriptor,
- 'child_block': child_descriptor}
+ return {'cond_block': cond_block,
+ 'source_block': source_block,
+ 'child_block': child_block}
class ConditionalBlockBasicTest(unittest.TestCase):
@@ -228,10 +228,10 @@ class ConditionalBlockXmlTest(unittest.TestCase):
self.course = courses[0]
def get_block_for_location(self, location):
- descriptor = self.modulestore.get_item(location, depth=None)
- return self.test_system.get_block_for_descriptor(descriptor)
+ block = self.modulestore.get_item(location, depth=None)
+ return self.test_system.get_block_for_descriptor(block)
- @patch('xmodule.x_module.descriptor_global_local_resource_url')
+ @patch('xmodule.x_module.block_global_local_resource_url')
@patch.dict(settings.FEATURES, {'ENABLE_EDXNOTES': False})
def test_conditional_block(self, _):
"""Make sure that conditional block works"""
diff --git a/xmodule/tests/test_course_block.py b/xmodule/tests/test_course_block.py
index 183a4f9c06..0adca42369 100644
--- a/xmodule/tests/test_course_block.py
+++ b/xmodule/tests/test_course_block.py
@@ -235,36 +235,36 @@ class IsNewCourseTestCase(unittest.TestCase):
assert d.start_date_is_still_default == s[3]
def test_display_organization(self):
- descriptor = get_dummy_course(start='2012-12-02T12:00', is_new=True)
- assert descriptor.location.org != descriptor.display_org_with_default
- assert descriptor.display_org_with_default == f'{ORG}_display'
+ block = get_dummy_course(start='2012-12-02T12:00', is_new=True)
+ assert block.location.org != block.display_org_with_default
+ assert block.display_org_with_default == f'{ORG}_display'
def test_display_coursenumber(self):
- descriptor = get_dummy_course(start='2012-12-02T12:00', is_new=True)
- assert descriptor.location.course != descriptor.display_number_with_default
- assert descriptor.display_number_with_default == f'{COURSE}_display'
+ block = get_dummy_course(start='2012-12-02T12:00', is_new=True)
+ assert block.location.course != block.display_number_with_default
+ assert block.display_number_with_default == f'{COURSE}_display'
def test_is_newish(self):
- descriptor = get_dummy_course(start='2012-12-02T12:00', is_new=True)
- assert descriptor.is_newish is True
+ block = get_dummy_course(start='2012-12-02T12:00', is_new=True)
+ assert block.is_newish is True
- descriptor = get_dummy_course(start='2013-02-02T12:00', is_new=False)
- assert descriptor.is_newish is False
+ block = get_dummy_course(start='2013-02-02T12:00', is_new=False)
+ assert block.is_newish is False
- descriptor = get_dummy_course(start='2013-02-02T12:00', is_new=True)
- assert descriptor.is_newish is True
+ block = get_dummy_course(start='2013-02-02T12:00', is_new=True)
+ assert block.is_newish is True
- descriptor = get_dummy_course(start='2013-01-15T12:00')
- assert descriptor.is_newish is True
+ block = get_dummy_course(start='2013-01-15T12:00')
+ assert block.is_newish is True
- descriptor = get_dummy_course(start='2013-03-01T12:00')
- assert descriptor.is_newish is True
+ block = get_dummy_course(start='2013-03-01T12:00')
+ assert block.is_newish is True
- descriptor = get_dummy_course(start='2012-10-15T12:00')
- assert descriptor.is_newish is False
+ block = get_dummy_course(start='2012-10-15T12:00')
+ assert block.is_newish is False
- descriptor = get_dummy_course(start='2012-12-31T12:00')
- assert descriptor.is_newish is True
+ block = get_dummy_course(start='2012-12-31T12:00')
+ assert block.is_newish is True
class DiscussionTopicsTestCase(unittest.TestCase):
diff --git a/xmodule/tests/test_error_block.py b/xmodule/tests/test_error_block.py
index f80fb905cb..b585b1c439 100644
--- a/xmodule/tests/test_error_block.py
+++ b/xmodule/tests/test_error_block.py
@@ -31,14 +31,14 @@ class TestErrorBlock(SetupTestErrorBlock):
"""
def test_error_block_xml_rendering(self):
- descriptor = ErrorBlock.from_xml(
+ block = ErrorBlock.from_xml(
self.valid_xml,
self.system,
CourseLocationManager(self.course_id),
self.error_msg
)
- assert isinstance(descriptor, ErrorBlock)
- descriptor.runtime = self.system
- context_repr = self.system.render(descriptor, STUDENT_VIEW).content
+ assert isinstance(block, ErrorBlock)
+ block.runtime = self.system
+ context_repr = self.system.render(block, STUDENT_VIEW).content
assert self.error_msg in context_repr
assert repr(self.valid_xml) in context_repr
diff --git a/xmodule/tests/test_export.py b/xmodule/tests/test_export.py
index 0e6469db70..7d6316a6a1 100644
--- a/xmodule/tests/test_export.py
+++ b/xmodule/tests/test_export.py
@@ -28,22 +28,22 @@ from xmodule.tests import DATA_DIR
from xmodule.x_module import XModuleMixin
-def strip_filenames(descriptor):
+def strip_filenames(block):
"""
Recursively strips 'filename' from all children's definitions.
"""
- print(f"strip filename from {str(descriptor.location)}")
- if descriptor._field_data.has(descriptor, 'filename'): # lint-amnesty, pylint: disable=protected-access
- descriptor._field_data.delete(descriptor, 'filename') # lint-amnesty, pylint: disable=protected-access
+ print(f"strip filename from {str(block.location)}")
+ if block._field_data.has(block, 'filename'): # lint-amnesty, pylint: disable=protected-access
+ block._field_data.delete(block, 'filename') # lint-amnesty, pylint: disable=protected-access
- if hasattr(descriptor, 'xml_attributes'):
- if 'filename' in descriptor.xml_attributes:
- del descriptor.xml_attributes['filename']
+ if hasattr(block, 'xml_attributes'):
+ if 'filename' in block.xml_attributes:
+ del block.xml_attributes['filename']
- for child in descriptor.get_children():
+ for child in block.get_children():
strip_filenames(child)
- descriptor.save()
+ block.save()
class PureXBlock(XBlock):
diff --git a/xmodule/tests/test_html_block.py b/xmodule/tests/test_html_block.py
index df8c803b52..019b32f095 100644
--- a/xmodule/tests/test_html_block.py
+++ b/xmodule/tests/test_html_block.py
@@ -16,9 +16,9 @@ from ..x_module import PUBLIC_VIEW, STUDENT_VIEW
from . import get_test_descriptor_system, get_test_system
-def instantiate_descriptor(**field_data):
+def instantiate_block(**field_data):
"""
- Instantiate descriptor with most properties.
+ Instantiate block with most properties.
"""
system = get_test_descriptor_system()
course_key = CourseLocator('org', 'course', 'run')
@@ -152,8 +152,8 @@ class HtmlBlockIndexingTestCase(unittest.TestCase):
Hello World!