Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
caf6afea
Commit
caf6afea
authored
Jul 16, 2014
by
gradyward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the Rendering Order of Assessment Modules
parent
9e75cf97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
1 deletions
+67
-1
openassessment/xblock/test/test_studio.py
+66
-0
requirements/base.txt
+1
-1
No files found.
openassessment/xblock/test/test_studio.py
View file @
caf6afea
...
@@ -7,6 +7,7 @@ import datetime as dt
...
@@ -7,6 +7,7 @@ import datetime as dt
import
pytz
import
pytz
from
ddt
import
ddt
,
file_data
from
ddt
import
ddt
,
file_data
from
.base
import
scenario
,
XBlockHandlerTestCase
from
.base
import
scenario
,
XBlockHandlerTestCase
import
xml.etree.ElementTree
as
etree
@ddt
@ddt
...
@@ -81,3 +82,67 @@ class StudioViewTest(XBlockHandlerTestCase):
...
@@ -81,3 +82,67 @@ class StudioViewTest(XBlockHandlerTestCase):
self
.
assertTrue
(
resp
[
'success'
])
self
.
assertTrue
(
resp
[
'success'
])
self
.
assertFalse
(
resp
[
'is_released'
])
self
.
assertFalse
(
resp
[
'is_released'
])
self
.
assertIn
(
'msg'
,
resp
)
self
.
assertIn
(
'msg'
,
resp
)
@scenario
(
'data/example_based_assessment.xml'
)
def
test_assessment_module_ordering_example_based
(
self
,
xblock
):
self
.
assert_assessment_order_
(
xblock
)
@scenario
(
'data/basic_scenario.xml'
)
def
test_assessment_module_ordering_basic
(
self
,
xblock
):
self
.
assert_assessment_order_
(
xblock
)
@scenario
(
'data/self_then_peer.xml'
)
def
test_assessment_module_ordering_self_peer
(
self
,
xblock
):
self
.
assert_assessment_order_
(
xblock
)
@scenario
(
'data/student_training.xml'
)
def
test_assessment_module_ordering_student_training
(
self
,
xblock
):
self
.
assert_assessment_order_
(
xblock
)
@scenario
(
'data/self_only_scenario.xml'
)
def
test_assessment_module_ordering_self_only
(
self
,
xblock
):
self
.
assert_assessment_order_
(
xblock
)
def
assert_assessment_order_
(
self
,
xblock
):
"""
Asserts that the assessment module editors are rendered in the correct order.
Renders the Studio View, and then examines the html body for the tags that we anticipate
to be in the tag for each editor, and compare the order. If it is anything besides
strictly increasing, we say that they rendered in the incorrect order.
"""
frag
=
self
.
runtime
.
render
(
xblock
,
'studio_view'
)
frag
=
frag
.
body_html
()
assessments_in_order
=
self
.
_find_assessment_order
(
xblock
)
assessment_indicies
=
[
frag
.
find
(
assessment
)
for
assessment
in
assessments_in_order
]
# Asserts that for any pairwise comparison of elements n and n-1 in the lookup of indicies
# the value at n will be greater than n-1 (i.e. the place we find one ID is after the one before it)
self
.
assertTrue
(
all
(
a
<
b
for
a
,
b
in
zip
(
assessment_indicies
,
assessment_indicies
[
1
:]))
)
def
_find_assessment_order
(
self
,
xblock
):
"""
Finds the order that we anticipate HTML ID tags of the section editors within the settings editor.
Returns:
A list with the four setting editor IDs, in the the order that we would anticipate given
the Xblock's problem definition that is handed in.
"""
assessments
=
[]
for
assessment
in
xblock
.
rubric_assessments
:
assessments
.
append
(
assessment
[
'name'
]
.
replace
(
'-'
,
'_'
))
all_assessments
=
{
'student_training'
,
'peer_assessment'
,
'self_assessment'
,
'example_based_assessment'
}
unused_assessments
=
list
(
all_assessments
-
set
(
assessments
))
assessments
.
extend
(
unused_assessments
)
id_dictionary
=
{
"example_based_assessment"
:
"oa_ai_assessment_editor"
,
"peer_assessment"
:
"oa_peer_assessment_editor"
,
"self_assessment"
:
"oa_self_assessment_editor"
,
"student_training"
:
"oa_student_training_editor"
}
return
[
id_dictionary
[
name
]
for
name
in
assessments
]
\ No newline at end of file
requirements/base.txt
View file @
caf6afea
...
@@ -21,7 +21,7 @@ djangorestframework==2.3.5
...
@@ -21,7 +21,7 @@ djangorestframework==2.3.5
lazy==1.1
lazy==1.1
loremipsum==1.0.2
loremipsum==1.0.2
python-dateutil==2.1
python-dateutil==2.1
python-memcached==1.
53
python-memcached==1.
48
pytz==2012h
pytz==2012h
South==0.7.6
South==0.7.6
voluptuous==0.8.5
voluptuous==0.8.5
...
...
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