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
daf4840c
Commit
daf4840c
authored
May 29, 2014
by
Oleg Marshev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add span tag.
parent
0a30f24e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
common/lib/capa/capa/inputtypes.py
+1
-1
common/lib/capa/capa/tests/test_inputtypes.py
+29
-3
No files found.
common/lib/capa/capa/inputtypes.py
View file @
daf4840c
...
...
@@ -834,7 +834,7 @@ class MatlabInput(CodeInput):
'audio'
:
[
'controls'
,
'autobuffer'
,
'autoplay'
,
'src'
],
'img'
:
[
'src'
,
'width'
,
'height'
,
'class'
]})
self
.
queue_msg
=
bleach
.
clean
(
self
.
input_state
[
'queue_msg'
],
tags
=
bleach
.
ALLOWED_TAGS
+
[
'div'
,
'p'
,
'audio'
,
'pre'
,
'img'
],
tags
=
bleach
.
ALLOWED_TAGS
+
[
'div'
,
'p'
,
'audio'
,
'pre'
,
'img'
,
'span'
],
styles
=
[
'white-space'
],
attributes
=
attributes
)
...
...
common/lib/capa/capa/tests/test_inputtypes.py
View file @
daf4840c
...
...
@@ -601,7 +601,6 @@ class MatlabTest(unittest.TestCase):
elt
=
etree
.
fromstring
(
self
.
xml
)
the_input
=
self
.
input_class
(
test_capa_system
(),
elt
,
state
)
context
=
the_input
.
_get_render_context
()
self
.
assertEqual
(
the_input
.
status
,
'queued'
)
...
...
@@ -612,7 +611,6 @@ class MatlabTest(unittest.TestCase):
elt
=
etree
.
fromstring
(
self
.
xml
)
the_input
=
self
.
input_class
(
test_capa_system
(),
elt
,
state
)
context
=
the_input
.
_get_render_context
()
self
.
assertEqual
(
the_input
.
status
,
'unsubmitted'
)
self
.
assertEqual
(
the_input
.
msg
,
'No response from Xqueue within {} seconds. Aborted.'
.
format
(
XQUEUE_TIMEOUT
))
...
...
@@ -625,7 +623,6 @@ class MatlabTest(unittest.TestCase):
elt
=
etree
.
fromstring
(
self
.
xml
)
the_input
=
self
.
input_class
(
test_capa_system
(),
elt
,
state
)
context
=
the_input
.
_get_render_context
()
self
.
assertEqual
(
the_input
.
status
,
'unsubmitted'
)
...
...
@@ -714,6 +711,35 @@ class MatlabTest(unittest.TestCase):
received
=
fromstring
(
context
[
'queue_msg'
])
html_tree_equal
(
received
,
expected
)
def
test_matlab_queue_message_allowed_tags
(
self
):
"""
Test allowed tags.
"""
allowed_tags
=
[
'div'
,
'p'
,
'audio'
,
'pre'
,
'span'
]
for
tag
in
allowed_tags
:
queue_msg
=
"<{0}>Test message</{0}>"
.
format
(
tag
)
state
=
{
'input_state'
:
{
'queue_msg'
:
queue_msg
},
'status'
:
'queued'
,
}
elt
=
etree
.
fromstring
(
self
.
xml
)
the_input
=
self
.
input_class
(
test_capa_system
(),
elt
,
state
)
self
.
assertEqual
(
the_input
.
queue_msg
,
queue_msg
)
def
test_matlab_queue_message_not_allowed_tag
(
self
):
"""
Test not allowed tag.
"""
not_allowed_tag
=
'script'
queue_msg
=
"<{0}>Test message</{0}>"
.
format
(
not_allowed_tag
)
state
=
{
'input_state'
:
{
'queue_msg'
:
queue_msg
},
'status'
:
'queued'
,
}
elt
=
etree
.
fromstring
(
self
.
xml
)
the_input
=
self
.
input_class
(
test_capa_system
(),
elt
,
state
)
expected
=
"<script>Test message</script>"
self
.
assertEqual
(
the_input
.
queue_msg
,
expected
)
def
html_tree_equal
(
received
,
expected
):
"""
...
...
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