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
a4717aca
Commit
a4717aca
authored
Apr 18, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pep8 fixes
parent
a57a093e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
common/lib/capa/capa/tests/test_input_templates.py
+10
-9
No files found.
common/lib/capa/capa/tests/test_input_templates.py
View file @
a4717aca
...
...
@@ -7,10 +7,12 @@ from lxml import etree
from
mako.template
import
Template
as
MakoTemplate
from
mako
import
exceptions
class
TemplateError
(
Exception
):
"""Error occurred while rendering a Mako template"""
pass
class
TemplateTestCase
(
unittest
.
TestCase
):
"""Utilitites for testing templates"""
...
...
@@ -23,8 +25,8 @@ class TemplateTestCase(unittest.TestCase):
def
setUp
(
self
):
"""Load the template"""
capa_path
=
capa
.
__path__
[
0
]
self
.
template_path
=
os
.
path
.
join
(
capa_path
,
'templates'
,
self
.
template_path
=
os
.
path
.
join
(
capa_path
,
'templates'
,
self
.
TEMPLATE_NAME
)
template_file
=
open
(
self
.
template_path
)
self
.
template
=
MakoTemplate
(
template_file
.
read
())
...
...
@@ -309,11 +311,10 @@ class TextlineTemplateTest(TemplateTestCase):
super
(
TextlineTemplateTest
,
self
)
.
setUp
()
def
test_section_class
(
self
):
cases
=
[
({},
' capa_inputtype '
),
({
'do_math'
:
True
},
'text-input-dynamath capa_inputtype '
),
({
'inline'
:
True
},
' capa_inputtype inline'
),
({
'do_math'
:
True
,
'inline'
:
True
},
'text-input-dynamath capa_inputtype inline'
),
]
cases
=
[({},
' capa_inputtype '
),
({
'do_math'
:
True
},
'text-input-dynamath capa_inputtype '
),
({
'inline'
:
True
},
' capa_inputtype inline'
),
({
'do_math'
:
True
,
'inline'
:
True
},
'text-input-dynamath capa_inputtype inline'
),
]
for
(
context
,
css_class
)
in
cases
:
base_context
=
self
.
context
.
copy
()
...
...
@@ -336,9 +337,9 @@ class TextlineTemplateTest(TemplateTestCase):
xpath
=
"//div[@class='
%
s ']"
%
div_class
self
.
assert_has_xpath
(
xml
,
xpath
,
self
.
context
)
# Expect that we get a <p> with class="status"
# Expect that we get a <p> with class="status"
# (used to by CSS to draw the green check / red x)
self
.
assert_has_text
(
xml
,
"//p[@class='status']"
,
self
.
assert_has_text
(
xml
,
"//p[@class='status']"
,
status_mark
,
exact
=
False
)
def
test_hidden
(
self
):
...
...
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