Skip to content

Commit

Permalink
Merge branch 'master' into fix_increase_item_id_max_length_02
Browse files Browse the repository at this point in the history
  • Loading branch information
vunguyen-dmt committed Mar 7, 2024
2 parents ee9a9db + 8de0eaf commit e6af99c
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 177 deletions.
2 changes: 1 addition & 1 deletion openassessment/__init__.py
Expand Up @@ -2,4 +2,4 @@
Initialization Information for Open Assessment Module
"""

__version__ = '6.5.0'
__version__ = '6.5.0'
11 changes: 1 addition & 10 deletions openassessment/xblock/openassessmentblock.py
Expand Up @@ -18,7 +18,7 @@
from webob import Response
from xblock.core import XBlock
from xblock.exceptions import NoSuchServiceError
from xblock.fields import Boolean, Dict, Integer, List, Scope, String
from xblock.fields import Boolean, Integer, List, Scope, String

from openassessment.staffgrader.staff_grader_mixin import StaffGraderMixin
from openassessment.workflow.errors import AssessmentWorkflowError
Expand Down Expand Up @@ -283,9 +283,6 @@ class OpenAssessmentBlock(
help="A title to display to a student (plain text)."
)

xml_attributes = Dict(help="Map of unhandled xml attributes, used only for storage between import and export",
default={}, scope=Scope.settings)

white_listed_file_types = List(
default=[],
scope=Scope.content,
Expand Down Expand Up @@ -938,12 +935,6 @@ def parse_xml(cls, node, runtime, keys, id_generator):
block.text_response_editor = config['text_response_editor']
block.title = config['title']
block.white_listed_file_types_string = config['white_listed_file_types']

# Deserialize and add tag data info to block if any
if hasattr(block, 'read_tags_from_node') and callable(block.read_tags_from_node): # pylint: disable=no-member
# This comes from TaggedBlockMixin
block.read_tags_from_node(node) # pylint: disable=no-member

return block

@property
Expand Down
93 changes: 0 additions & 93 deletions openassessment/xblock/test/data/content_tags.xml

This file was deleted.

33 changes: 1 addition & 32 deletions openassessment/xblock/test/test_openassessment.py
Expand Up @@ -8,7 +8,6 @@
from unittest import mock
from unittest.mock import MagicMock, Mock, PropertyMock, patch
from django.test.utils import override_settings
from workbench.runtime import WorkbenchRuntime

import ddt
import pytz
Expand All @@ -25,29 +24,6 @@
from .base import XBlockHandlerTestCase, scenario


original_construct_xblock_from_class = WorkbenchRuntime.construct_xblock_from_class


def _read_tags_from_node(self, node):
"""
This method is originally defined in the XmlMixin in edx-platform.
"""
assert 'tags-v1' in node.attrib
self.xml_attributes['tags-v1'] = str(node.attrib['tags-v1'])


def _construct_xblock_from_class(*args, **kwargs):
"""
Mock the original construct_xblock_from_class method to add the read_tags_from_node method and xml_attributes
property to the xblock.
In edx-platform, these members are part of the XmlMixin.
"""
xblock = original_construct_xblock_from_class(*args, **kwargs)
xblock.read_tags_from_node = lambda node: _read_tags_from_node(xblock, node)
return xblock


def assert_is_closed(
xblock,
now,
Expand Down Expand Up @@ -782,12 +758,6 @@ def test_mfe_views_supported__rearranged_steps(self, xblock):
# Given this ORA has rearranged our assessment steps
self.assertTrue(xblock.mfe_views_supported)

@patch.object(WorkbenchRuntime, 'construct_xblock_from_class', new=_construct_xblock_from_class)
@scenario('data/content_tags.xml')
def test_content_tags(self, xblock):
# Check if content tags are set properly
self.assertEqual(xblock.xml_attributes["tags-v1"], "test content tags")


class TestDates(XBlockHandlerTestCase):
""" Test Assessment Dates. """
Expand Down Expand Up @@ -1215,8 +1185,7 @@ def defined_manual_dates(self, xblock, step):
dt.datetime.fromisoformat(assessment.get('start')),
dt.datetime.fromisoformat(assessment.get('due'))
)

assert False, f"Assessment {step} not found" # pragma: no cover
return None # pragma: no cover

def setup_dates(self, xblock, course_dates=None, subsection_dates=None):
"""
Expand Down
34 changes: 0 additions & 34 deletions openassessment/xblock/test/test_xml.py
Expand Up @@ -216,40 +216,6 @@ def test_serialize_assessments(self, data):
xml_str = serialize_assessments_to_xml_str(self.oa_block)
self.assertIn(data['assessments'][0]['name'], xml_str)

@ddt.file_data('data/serialize.json')
def test_serialize_with_tags(self, data):
self._configure_xblock(data)

# Create a mocked serialize tag data method that returns no data
def add_tags_to_node_no_tags(node): # pylint: disable=unused-argument
return

# Manually add the mocked method to the OpenAssessment block instance
# This method will be added in the edx-platform repo through applying XBLOCK_MIXINS
self.oa_block.add_tags_to_node = add_tags_to_node_no_tags

xml = serialize_content(self.oa_block)

# Confirm that no tags appear in the xml
self.assertNotIn("tags-v1", xml)

# Create a mocked serialize tag data method that returns data
def add_tags_to_node_with_tags(node):
# return "lightcast-skills:Typing,Microsoft Office"
node.set('tags-v1', 'lightcast-skills:Typing,Microsoft Office')

# Manually add the mocked method to the OpenAssessment block instance
# This method will be added in the edx-platform repo through applying XBLOCK_MIXINS
self.oa_block.add_tags_to_node = add_tags_to_node_with_tags

xml = serialize_content(self.oa_block)

# Confirm that tags appear in the xml
self.assertIn("tags-v1=\"lightcast-skills:Typing,Microsoft Office\"", xml)

# Clear the mocked serialize tag data method
del self.oa_block.add_tags_to_node

def test_mutated_criteria_dict(self):
self._configure_xblock({})

Expand Down
5 changes: 0 additions & 5 deletions openassessment/xblock/utils/xml.py
Expand Up @@ -772,11 +772,6 @@ def serialize_content_to_xml(oa_block, root):
if oa_block.show_rubric_during_response is not None:
root.set('show_rubric_during_response', str(oa_block.show_rubric_during_response))

# Serialize and add tag data if any
if hasattr(oa_block, 'add_tags_to_node') and callable(oa_block.add_tags_to_node): # pylint: disable=no-member
# This comes from TaggedBlockMixin
oa_block.add_tags_to_node(root) # pylint: disable=no-member


def serialize_content(oa_block):
"""
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e6af99c

Please sign in to comment.