"""
Tests for the Unit XBlock
"""
import unittest
from unittest.mock import patch
from xml.etree import ElementTree
from web_fragments.fragment import Fragment
from xblock.core import XBlock
from xblock.completable import XBlockCompletionMode
from xblock.test.test_parsing import XmlTest
from xmodule.unit_block import UnitBlock
class FakeHTMLBlock(XBlock):
""" An HTML block for use in tests """
def student_view(self, context=None): # pylint: disable=unused-argument
"""Provide simple HTML student view."""
return Fragment("This is some HTML.")
class FakeVideoBlock(XBlock):
""" A video block for use in tests """
def student_view(self, context=None): # pylint: disable=unused-argument
"""Provide simple Video student view."""
return Fragment(
''
)
class UnitBlockTests(XmlTest, unittest.TestCase):
"""
Tests of the Unit XBlock.
There's not much to this block, so we keep it simple.
"""
maxDiff = None
@XBlock.register_temp_plugin(FakeHTMLBlock, identifier='fake-html')
@XBlock.register_temp_plugin(FakeVideoBlock, identifier='fake-video')
def test_unit_html(self):
block = self.parse_xml_to_block("""\