Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
problem-builder
Commits
a7717ea8
Commit
a7717ea8
authored
Mar 02, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
light-children: Fix tests runner
parent
b970de42
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
23 deletions
+43
-23
mentoring/light_children.py
+28
-11
mentoring/test_base.py
+1
-1
mentoring/utils.py
+2
-1
tests/xml/table_2.xml
+12
-10
No files found.
mentoring/light_children.py
View file @
a7717ea8
...
@@ -33,7 +33,12 @@ from django.core.urlresolvers import reverse
...
@@ -33,7 +33,12 @@ from django.core.urlresolvers import reverse
from
xblock.core
import
XBlock
from
xblock.core
import
XBlock
from
xblock.fragment
import
Fragment
from
xblock.fragment
import
Fragment
from
xblock.plugin
import
Plugin
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
from
.utils
import
XBlockWithChildrenFragmentsMixin
...
@@ -162,17 +167,21 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
...
@@ -162,17 +167,21 @@ class XBlockWithLightChildren(LightChildrenMixin, XBlock):
Current HTML view of the XBlock, for refresh by client
Current HTML view of the XBlock, for refresh by client
"""
"""
# TODO: Why do we need to use `xmodule_runtime` and not `runtime`?
# TODO: Why do we need to use `xmodule_runtime` and not `runtime`?
course_id
=
self
.
xmodule_runtime
.
course_id
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
=
self
.
student_view
({})
frag
=
replace_jump_to_id_urls
(
frag
=
replace_jump_to_id_urls
(
course_id
,
jump_to_url
,
self
,
'student_view'
,
frag
,
{})
course_id
,
reverse
(
'jump_to_id'
,
kwargs
=
{
'course_id'
:
course_id
,
'module_id'
:
''
}),
self
,
'student_view'
,
frag
,
{}
)
return
{
return
{
'html'
:
frag
.
content
,
'html'
:
frag
.
content
,
}
}
...
@@ -194,7 +203,15 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -194,7 +203,15 @@ class LightChild(Plugin, LightChildrenMixin):
@property
@property
def
xmodule_runtime
(
self
):
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
):
def
save
(
self
):
pass
pass
...
...
mentoring/test_base.py
View file @
a7717ea8
...
@@ -39,7 +39,7 @@ class MentoringBaseTest(SeleniumTest):
...
@@ -39,7 +39,7 @@ class MentoringBaseTest(SeleniumTest):
# Use test scenarios
# Use test scenarios
self
.
browser
.
get
(
self
.
live_server_url
)
# Needed to load tests once
self
.
browser
.
get
(
self
.
live_server_url
)
# Needed to load tests once
scenarios
.
SCENARIOS
.
clear
()
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
:
for
identifier
,
title
,
xml
in
scenarios_list
:
self
.
addCleanup
(
scenarios
.
remove_scenario
,
identifier
)
self
.
addCleanup
(
scenarios
.
remove_scenario
,
identifier
)
...
...
mentoring/utils.py
View file @
a7717ea8
...
@@ -71,8 +71,9 @@ def get_scenarios_from_path(scenarios_path, include_identifier=False):
...
@@ -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,
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
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
)
scenarios_fullpath
=
os
.
path
.
join
(
base_fullpath
,
scenarios_path
)
print
scenarios_fullpath
scenarios
=
[]
scenarios
=
[]
if
os
.
path
.
isdir
(
scenarios_fullpath
):
if
os
.
path
.
isdir
(
scenarios_fullpath
):
...
...
tests/xml/table_2.xml
View file @
a7717ea8
<vertical>
<vertical>
<mentoring-table
type=
"table_test"
url_name=
"table_2"
>
<mentoring
display_submit=
"false"
enforce_dependency=
"false"
>
<column>
<mentoring-table
type=
"table_test"
url_name=
"table_2"
>
<header>
Header Test 1
</header>
<column>
<answer
name=
"table_1_answer_1"
/>
<header>
Header Test 1
</header>
</column>
<answer
name=
"table_1_answer_1"
/>
</column>
<column>
<column>
<header>
Header Test 2
</header>
<header>
Header Test 2
</header>
<answer
name=
"table_1_answer_2"
/>
<answer
name=
"table_1_answer_2"
/>
</column>
</column>
</mentoring-table>
</mentoring-table>
</mentoring>
</vertical>
</vertical>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment