Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
493421c1
Commit
493421c1
authored
Mar 06, 2013
by
Vasyl Nakvasiuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix `test_conditional`, add new conditional to "conditional_and_poll" test course
parent
3270caed
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
7 deletions
+46
-7
common/lib/xmodule/xmodule/tests/test_conditional.py
+11
-7
common/test/data/conditional_and_poll/conditional/condone.xml
+3
-0
common/test/data/conditional_and_poll/course/2013_Spring.xml
+6
-0
common/test/data/conditional_and_poll/html/secret_page.xml
+4
-0
common/test/data/conditional_and_poll/problem/choiceprob.xml
+22
-0
No files found.
common/lib/xmodule/xmodule/tests/test_conditional.py
View file @
493421c1
...
...
@@ -70,7 +70,7 @@ class ConditionalModuleTest(unittest.TestCase):
"""Make sure that conditional module works"""
print
"Starting import"
course
=
self
.
get_course
(
'conditional'
)
course
=
self
.
get_course
(
'conditional
_and_poll
'
)
print
"Course: "
,
course
print
"id: "
,
course
.
id
...
...
@@ -82,7 +82,9 @@ class ConditionalModuleTest(unittest.TestCase):
location
=
descriptor
.
location
return
descriptor
.
xmodule
(
test_system
)
location
=
Location
([
"i4x"
,
"edX"
,
"cond_test"
,
"conditional"
,
"condone"
])
# edx - HarvardX
# cond_test - ER22x
location
=
Location
([
"i4x"
,
"HarvardX"
,
"ER22x"
,
"conditional"
,
"condone"
])
def
replace_urls
(
text
,
staticfiles_prefix
=
None
,
replace_prefix
=
'/static/'
,
course_namespace
=
None
):
return
text
...
...
@@ -91,14 +93,14 @@ class ConditionalModuleTest(unittest.TestCase):
module
=
inner_get_module
(
location
)
print
"module: "
,
module
print
"module.condition
: "
,
module
.
condition
print
"module.condition
s_map: "
,
module
.
conditions_map
print
"module children: "
,
module
.
get_children
()
print
"module display items (children): "
,
module
.
get_display_items
()
html
=
module
.
get_html
()
print
"html type: "
,
type
(
html
)
print
"html: "
,
html
html_expect
=
"{'ajax_url': 'courses/course_id/modx/a_location', 'element_id': 'i4x-
edX-cond_test-conditional-condone', 'id': 'i4x://edX/cond_test/conditional/condone
'}"
html_expect
=
"{'ajax_url': 'courses/course_id/modx/a_location', 'element_id': 'i4x-
HarvardX-ER22x-conditional-condone', 'id': 'i4x://HarvardX/ER22x/conditional/condone', 'depends': 'i4x-HarvardX-ER22x-problem-choiceprob
'}"
self
.
assertEqual
(
html
,
html_expect
)
gdi
=
module
.
get_display_items
()
...
...
@@ -106,11 +108,13 @@ class ConditionalModuleTest(unittest.TestCase):
ajax
=
json
.
loads
(
module
.
handle_ajax
(
''
,
''
))
print
"ajax: "
,
ajax
self
.
assertTrue
(
'ConditionalModule'
in
ajax
[
'html'
])
html
=
ajax
[
'html'
]
self
.
assertFalse
(
any
([
'This is a secret'
in
item
for
item
in
html
]))
# now change state of the capa problem to make it completed
inner_get_module
(
Location
(
'i4x://
edX/cond_test
/problem/choiceprob'
))
.
attempts
=
1
inner_get_module
(
Location
(
'i4x://
HarvardX/ER22x
/problem/choiceprob'
))
.
attempts
=
1
ajax
=
json
.
loads
(
module
.
handle_ajax
(
''
,
''
))
print
"post-attempt ajax: "
,
ajax
self
.
assertTrue
(
'This is a secret'
in
ajax
[
'html'
])
html
=
ajax
[
'html'
]
self
.
assertTrue
(
any
([
'This is a secret'
in
item
for
item
in
html
]))
common/test/data/conditional_and_poll/conditional/condone.xml
0 → 100644
View file @
493421c1
<conditional
attempted=
"True"
sources=
"i4x://HarvardX/ER22x/problem/choiceprob"
>
<html
url_name=
"secret_page"
/>
</conditional>
common/test/data/conditional_and_poll/course/2013_Spring.xml
View file @
493421c1
...
...
@@ -2,5 +2,11 @@
Take note of this name exactly, you'll need to use it everywhere. -->
<course>
<chapter
url_name=
"Staff"
/>
<chapter
name=
"Problems with Condition"
>
<sequential>
<problem
url_name=
"choiceprob"
/>
<conditional
url_name=
"condone"
/>
</sequential>
</chapter>
</course>
common/test/data/conditional_and_poll/html/secret_page.xml
0 → 100644
View file @
493421c1
<html
display_name=
"Secret Page"
>
<p>
This is a secret!
</p>
</html>
common/test/data/conditional_and_poll/problem/choiceprob.xml
0 → 100644
View file @
493421c1
<problem
display_name=
"S3E2: Lorentz Force"
>
<startouttext/>
<p>
Consider a hypothetical magnetic field pointing out of your computer screen. Now imagine an electron traveling from right to left in the plane of your screen. A diagram of this situation is show below…
</p>
<center><img
width=
"400"
src=
"/static/images/LSQimages/LSQ_W01_8.png"
/></center>
<p>
a. The magnitude of the force experienced by the electron is proportional the product of which of the following? (Select all that apply.)
</p>
<endouttext/>
<choiceresponse>
<checkboxgroup>
<!-- include ellipses to test non-ascii characters -->
<choice
correct=
"true"
><text>
Magnetic field strength…
</text></choice>
<choice
correct=
"false"
><text>
Electric field strength…
</text></choice>
<choice
correct=
"true"
><text>
Electric charge of the electron…
</text></choice>
<choice
correct=
"false"
><text>
Radius of the electron…
</text></choice>
<choice
correct=
"false"
><text>
Mass of the electron…
</text></choice>
<choice
correct=
"true"
><text>
Velocity of the electron…
</text></choice>
</checkboxgroup>
</choiceresponse>
</problem>
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