refactor: enable the Extracted Annotatable, Poll XBlocks
Enabled the Extracted Annotatable, Poll XBlocks --------- Co-authored-by: farhan <farhan.khan@arbisoft.com>
This commit is contained in:
committed by
GitHub
parent
610e2ab14b
commit
24cb3cf9f5
@@ -1676,7 +1676,7 @@ USE_EXTRACTED_WORD_CLOUD_BLOCK = False
|
||||
# .. toggle_warning: Not production-ready until https://github.com/openedx/edx-platform/issues/34841 is done.
|
||||
# .. toggle_creation_date: 2024-11-10
|
||||
# .. toggle_target_removal_date: 2025-06-01
|
||||
USE_EXTRACTED_ANNOTATABLE_BLOCK = False
|
||||
USE_EXTRACTED_ANNOTATABLE_BLOCK = True
|
||||
|
||||
# .. toggle_name: USE_EXTRACTED_POLL_QUESTION_BLOCK
|
||||
# .. toggle_default: False
|
||||
@@ -1686,7 +1686,7 @@ USE_EXTRACTED_ANNOTATABLE_BLOCK = False
|
||||
# .. toggle_warning: Not production-ready until https://github.com/openedx/edx-platform/issues/34839 is done.
|
||||
# .. toggle_creation_date: 2024-11-10
|
||||
# .. toggle_target_removal_date: 2025-06-01
|
||||
USE_EXTRACTED_POLL_QUESTION_BLOCK = False
|
||||
USE_EXTRACTED_POLL_QUESTION_BLOCK = True
|
||||
|
||||
# .. toggle_name: USE_EXTRACTED_LTI_BLOCK
|
||||
# .. toggle_default: False
|
||||
|
||||
@@ -136,7 +136,3 @@ django-debug-toolbar<6.0.0
|
||||
# Issue: https://github.com/openedx/edx-platform/issues/37435
|
||||
cryptography<46.0.0
|
||||
pact-python<3.0.0
|
||||
|
||||
# This pin will be removed once the following PR is merged
|
||||
# https://github.com/openedx/xblocks-contrib/pull/120
|
||||
xblocks-contrib<0.9.0
|
||||
|
||||
@@ -1277,10 +1277,8 @@ xblock-utils==4.0.0
|
||||
# via
|
||||
# edx-sga
|
||||
# xblock-poll
|
||||
xblocks-contrib==0.8.1
|
||||
# via
|
||||
# -c requirements/constraints.txt
|
||||
# -r requirements/edx/bundled.in
|
||||
xblocks-contrib==0.9.0
|
||||
# via -r requirements/edx/bundled.in
|
||||
xmlsec==1.3.14
|
||||
# via
|
||||
# -c requirements/constraints.txt
|
||||
|
||||
@@ -2308,9 +2308,8 @@ xblock-utils==4.0.0
|
||||
# -r requirements/edx/testing.txt
|
||||
# edx-sga
|
||||
# xblock-poll
|
||||
xblocks-contrib==0.8.1
|
||||
xblocks-contrib==0.9.0
|
||||
# via
|
||||
# -c requirements/constraints.txt
|
||||
# -r requirements/edx/doc.txt
|
||||
# -r requirements/edx/testing.txt
|
||||
xmlsec==1.3.14
|
||||
|
||||
@@ -1615,10 +1615,8 @@ xblock-utils==4.0.0
|
||||
# -r requirements/edx/base.txt
|
||||
# edx-sga
|
||||
# xblock-poll
|
||||
xblocks-contrib==0.8.1
|
||||
# via
|
||||
# -c requirements/constraints.txt
|
||||
# -r requirements/edx/base.txt
|
||||
xblocks-contrib==0.9.0
|
||||
# via -r requirements/edx/base.txt
|
||||
xmlsec==1.3.14
|
||||
# via
|
||||
# -c requirements/constraints.txt
|
||||
|
||||
@@ -1708,10 +1708,8 @@ xblock-utils==4.0.0
|
||||
# -r requirements/edx/base.txt
|
||||
# edx-sga
|
||||
# xblock-poll
|
||||
xblocks-contrib==0.8.1
|
||||
# via
|
||||
# -c requirements/constraints.txt
|
||||
# -r requirements/edx/base.txt
|
||||
xblocks-contrib==0.9.0
|
||||
# via -r requirements/edx/base.txt
|
||||
xmlsec==1.3.14
|
||||
# via
|
||||
# -c requirements/constraints.txt
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"""Test for Word Cloud Block functional logic."""
|
||||
import json
|
||||
import os
|
||||
from unittest.mock import Mock
|
||||
|
||||
from django.conf import settings
|
||||
@@ -68,33 +67,13 @@ class _TestWordCloudBase(TestCase):
|
||||
assert block.num_inputs == 3
|
||||
assert block.num_top_words == 100
|
||||
|
||||
if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK:
|
||||
# For extracted XBlocks, we need to manually export the XML definition to a file to properly test the
|
||||
# import/export cycle. This is because extracted XBlocks use XBlock core's `add_xml_to_node` method,
|
||||
# which does not export the XML to a file like `XmlMixin.add_xml_to_node` does.
|
||||
filepath = 'word_cloud/block_id.xml'
|
||||
runtime.export_fs.makedirs(os.path.dirname(filepath), recreate=True)
|
||||
with runtime.export_fs.open(filepath, 'wb') as fileObj:
|
||||
runtime.export_to_xml(block, fileObj)
|
||||
else:
|
||||
node = etree.Element("unknown_root")
|
||||
# This will export the olx to a separate file.
|
||||
block.add_xml_to_node(node)
|
||||
node = etree.Element("unknown_root")
|
||||
# This will export the olx to a separate file.
|
||||
block.add_xml_to_node(node)
|
||||
|
||||
with runtime.export_fs.open('word_cloud/block_id.xml') as f:
|
||||
exported_xml = f.read()
|
||||
|
||||
if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK:
|
||||
# For extracted XBlocks, we need to remove the `xblock-family` attribute from the exported XML to ensure
|
||||
# consistency with the original XML.
|
||||
# This is because extracted XBlocks use the core XBlock's `add_xml_to_node` method, which includes this
|
||||
# attribute, whereas `XmlMixin.add_xml_to_node` does not.
|
||||
exported_xml_tree = etree.fromstring(exported_xml.encode('utf-8'))
|
||||
etree.cleanup_namespaces(exported_xml_tree)
|
||||
if 'xblock-family' in exported_xml_tree.attrib:
|
||||
del exported_xml_tree.attrib['xblock-family']
|
||||
exported_xml = etree.tostring(exported_xml_tree, encoding='unicode', pretty_print=True)
|
||||
|
||||
assert exported_xml == original_xml
|
||||
|
||||
def test_bad_ajax_request(self):
|
||||
|
||||
Reference in New Issue
Block a user