Commit 4f65d73c by dragonfi

Fix unittests after rebase

parent 57e6b421
...@@ -85,7 +85,14 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin): ...@@ -85,7 +85,14 @@ class LightChildrenMixin(XBlockWithChildrenFragmentsMixin):
log.debug('parse_xml called') log.debug('parse_xml called')
block = runtime.construct_xblock_from_class(cls, keys) block = runtime.construct_xblock_from_class(cls, keys)
cls.init_block_from_node(block, node, node.items()) cls.init_block_from_node(block, node, node.items())
block.xml_content = getattr(block, 'xml_content', '') or etree.tostring(node)
xml_content_value = getattr(block, 'xml_content', None)
xml_content_field = getattr(block.__class__, 'xml_content', None)
default_xml_content = getattr(xml_content_field, 'default', None)
if xml_content_value == default_xml_content:
block.xml_content = etree.tostring(node)
return block return block
@classmethod @classmethod
......
...@@ -49,9 +49,9 @@ log = logging.getLogger(__name__) ...@@ -49,9 +49,9 @@ log = logging.getLogger(__name__)
def default_xml_content(): def default_xml_content():
return render_template('templates/xml/mentoring_default.xml', { return loader.render_template(
'url_name': 'mentoring-{}'.format(uuid.uuid4())}) 'templates/xml/mentoring_default.xml',
{'url_name': 'mentoring-{}'.format(uuid.uuid4())})
# Classes ########################################################### # Classes ###########################################################
...@@ -66,6 +66,7 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin): ...@@ -66,6 +66,7 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin):
student is a) provided mentoring advices and asked to alter his answer, or b) is given the student is a) provided mentoring advices and asked to alter his answer, or b) is given the
ok to continue. ok to continue.
""" """
attempted = Boolean(help="Has the student attempted this mentoring step?", attempted = Boolean(help="Has the student attempted this mentoring step?",
default=False, scope=Scope.user_state) default=False, scope=Scope.user_state)
completed = Boolean(help="Has the student completed this mentoring step?", completed = Boolean(help="Has the student completed this mentoring step?",
...@@ -79,7 +80,7 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin): ...@@ -79,7 +80,7 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin):
enforce_dependency = Boolean(help="Should the next step be the current block to complete?", enforce_dependency = Boolean(help="Should the next step be the current block to complete?",
default=False, scope=Scope.content, enforce_type=True) default=False, scope=Scope.content, enforce_type=True)
display_submit = Boolean(help="Allow to submit current block?", default=True, scope=Scope.content) display_submit = Boolean(help="Allow to submit current block?", default=True, scope=Scope.content)
xml_content = String(help="XML content", default=default_xml_content, scope=Scope.content) xml_content = String(help="XML content", default=default_xml_content(), scope=Scope.content)
weight = Float(help="Defines the maximum total grade of the block.", weight = Float(help="Defines the maximum total grade of the block.",
default=1, scope=Scope.content, enforce_type=True) default=1, scope=Scope.content, enforce_type=True)
num_attempts = Integer(help="Number of attempts a user has answered for this questions", num_attempts = Integer(help="Number of attempts a user has answered for this questions",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment