Commit a7717ea8 by Xavier Antoviaque

light-children: Fix tests runner

parent b970de42
......@@ -33,7 +33,12 @@ from django.core.urlresolvers import reverse
from xblock.core import XBlock
from xblock.fragment import Fragment
from xblock.plugin import Plugin
from xmodule_modifiers import replace_jump_to_id_urls
try:
from xmodule_modifiers import replace_jump_to_id_urls
except:
# TODO-WORKBENCH-WORKAROUND: To allow to load from the workbench
replace_jump_to_id_urls = lambda a,b,c,d,frag,f: frag
from .utils import XBlockWithChildrenFragmentsMixin
......@@ -162,17 +167,21 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
Current HTML view of the XBlock, for refresh by client
"""
# TODO: Why do we need to use `xmodule_runtime` and not `runtime`?
try:
course_id = self.xmodule_runtime.course_id
except AttributeError:
# TODO-WORKBENCH-WORKAROUND: To allow to load from the workbench
course_id = 'sample-course'
try:
jump_to_url = reverse('jump_to_id', kwargs={'course_id': course_id, 'module_id': ''})
except:
# TODO-WORKBENCH-WORKAROUND: To allow to load from the workbench
jump_to_url = '/jump_to_id'
frag = self.student_view({})
frag = replace_jump_to_id_urls(
course_id,
reverse('jump_to_id', kwargs={'course_id': course_id, 'module_id': ''}),
self,
'student_view',
frag,
{}
)
frag = replace_jump_to_id_urls(course_id, jump_to_url, self, 'student_view', frag, {})
return {
'html': frag.content,
}
......@@ -194,7 +203,15 @@ class LightChild(Plugin, LightChildrenMixin):
@property
def xmodule_runtime(self):
return self.parent.xmodule_runtime
try:
xmodule_runtime = self.parent.xmodule_runtime
except AttributeError:
# TODO-WORKBENCH-WORKAROUND: To allow to load from the workbench
class xmodule_runtime(object):
course_id = 'sample-course'
anonymous_student_id = 'student1'
xmodule_runtime = xmodule_runtime()
return xmodule_runtime
def save(self):
pass
......
......@@ -39,7 +39,7 @@ class MentoringBaseTest(SeleniumTest):
# Use test scenarios
self.browser.get(self.live_server_url) # Needed to load tests once
scenarios.SCENARIOS.clear()
scenarios_list = load_scenarios_from_path('tests/xml')
scenarios_list = load_scenarios_from_path('../tests/xml')
for identifier, title, xml in scenarios_list:
self.addCleanup(scenarios.remove_scenario, identifier)
......
......@@ -71,8 +71,9 @@ def get_scenarios_from_path(scenarios_path, include_identifier=False):
Returns an array of (title, xmlcontent) from files contained in a specified directory,
formatted as expected for the return value of the workbench_scenarios() method
"""
base_fullpath = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
base_fullpath = os.path.dirname(os.path.realpath(__file__))
scenarios_fullpath = os.path.join(base_fullpath, scenarios_path)
print scenarios_fullpath
scenarios = []
if os.path.isdir(scenarios_fullpath):
......
<vertical>
<mentoring display_submit="false" enforce_dependency="false">
<mentoring-table type="table_test" url_name="table_2">
<column>
<header>Header Test 1</header>
......@@ -10,4 +11,5 @@
<answer name="table_1_answer_2" />
</column>
</mentoring-table>
</mentoring>
</vertical>
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