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
6647cc19
Commit
6647cc19
authored
Mar 26, 2014
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow capa poroblems access to anonymous_student_id
fix system->capa_system in capa_problem change for anonid
parent
97d587c4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
common/lib/capa/capa/capa_problem.py
+1
-0
common/lib/capa/capa/tests/test_html_render.py
+18
-0
No files found.
common/lib/capa/capa/capa_problem.py
View file @
6647cc19
...
@@ -620,6 +620,7 @@ class LoncapaProblem(object):
...
@@ -620,6 +620,7 @@ class LoncapaProblem(object):
"""
"""
context
=
{}
context
=
{}
context
[
'seed'
]
=
self
.
seed
context
[
'seed'
]
=
self
.
seed
context
[
'anonymous_student_id'
]
=
self
.
capa_system
.
anonymous_student_id
all_code
=
''
all_code
=
''
python_path
=
[]
python_path
=
[]
...
...
common/lib/capa/capa/tests/test_html_render.py
View file @
6647cc19
...
@@ -73,6 +73,24 @@ class CapaHtmlRenderTest(unittest.TestCase):
...
@@ -73,6 +73,24 @@ class CapaHtmlRenderTest(unittest.TestCase):
span_element
=
rendered_html
.
find
(
'span'
)
span_element
=
rendered_html
.
find
(
'span'
)
self
.
assertEqual
(
span_element
.
text
,
'Test text'
)
self
.
assertEqual
(
span_element
.
text
,
'Test text'
)
def
test_anonymous_student_id
(
self
):
# make sure anonymous_student_id is rendered properly as a context variable
xml_str
=
textwrap
.
dedent
(
"""
<problem>
<span>Welcome $anonymous_student_id</span>
</problem>
"""
)
# Create the problem
problem
=
new_loncapa_problem
(
xml_str
)
# Render the HTML
rendered_html
=
etree
.
XML
(
problem
.
get_html
())
# Expect that the anonymous_student_id was converted to "student"
span_element
=
rendered_html
.
find
(
'span'
)
self
.
assertEqual
(
span_element
.
text
,
'Welcome student'
)
def
test_render_script
(
self
):
def
test_render_script
(
self
):
# Generate some XML with a <script> tag
# Generate some XML with a <script> tag
xml_str
=
textwrap
.
dedent
(
"""
xml_str
=
textwrap
.
dedent
(
"""
...
...
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