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
6af857b3
Commit
6af857b3
authored
Mar 06, 2013
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1613 from MITx/victor/fix-blank-capa
Fix max_attempts=''
parents
28e300c0
b6a6e10b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
common/lib/capa/capa/tests/test_html_render.py
+14
-0
common/lib/xmodule/xmodule/capa_module.py
+2
-2
common/lib/xmodule/xmodule/tests/test_capa_module.py
+8
-0
No files found.
common/lib/capa/capa/tests/test_html_render.py
View file @
6af857b3
...
@@ -11,6 +11,20 @@ from . import test_system
...
@@ -11,6 +11,20 @@ from . import test_system
class
CapaHtmlRenderTest
(
unittest
.
TestCase
):
class
CapaHtmlRenderTest
(
unittest
.
TestCase
):
def
test_blank_problem
(
self
):
"""
It's important that blank problems don't break, since that's
what you start with in studio.
"""
xml_str
=
"<problem> </problem>"
# Create the problem
problem
=
LoncapaProblem
(
xml_str
,
'1'
,
system
=
test_system
)
# Render the HTML
rendered_html
=
etree
.
XML
(
problem
.
get_html
())
# expect that we made it here without blowing up
def
test_include_html
(
self
):
def
test_include_html
(
self
):
# Create a test file to include
# Create a test file to include
self
.
_create_test_file
(
'test_include.xml'
,
self
.
_create_test_file
(
'test_include.xml'
,
...
...
common/lib/xmodule/xmodule/capa_module.py
View file @
6af857b3
...
@@ -135,8 +135,8 @@ class CapaModule(XModule):
...
@@ -135,8 +135,8 @@ class CapaModule(XModule):
self
.
grace_period
=
None
self
.
grace_period
=
None
self
.
close_date
=
self
.
display_due_date
self
.
close_date
=
self
.
display_due_date
max_attempts
=
self
.
metadata
.
get
(
'attempts'
,
None
)
max_attempts
=
self
.
metadata
.
get
(
'attempts'
)
if
max_attempts
is
not
None
:
if
max_attempts
is
not
None
and
max_attempts
!=
''
:
self
.
max_attempts
=
int
(
max_attempts
)
self
.
max_attempts
=
int
(
max_attempts
)
else
:
else
:
self
.
max_attempts
=
None
self
.
max_attempts
=
None
...
...
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
6af857b3
...
@@ -144,6 +144,8 @@ class CapaModuleTest(unittest.TestCase):
...
@@ -144,6 +144,8 @@ class CapaModuleTest(unittest.TestCase):
"Factory should be creating unique names for each problem"
)
"Factory should be creating unique names for each problem"
)
def
test_correct
(
self
):
def
test_correct
(
self
):
"""
"""
Check that the factory creates correct and incorrect problems properly.
Check that the factory creates correct and incorrect problems properly.
...
@@ -784,6 +786,12 @@ class CapaModuleTest(unittest.TestCase):
...
@@ -784,6 +786,12 @@ class CapaModuleTest(unittest.TestCase):
module
.
lcp
.
done
=
True
module
.
lcp
.
done
=
True
self
.
assertTrue
(
module
.
should_show_save_button
())
self
.
assertTrue
(
module
.
should_show_save_button
())
def
test_no_max_attempts
(
self
):
module
=
CapaFactory
.
create
(
max_attempts
=
''
)
html
=
module
.
get_problem_html
()
# assert that we got here without exploding
def
test_get_problem_html
(
self
):
def
test_get_problem_html
(
self
):
module
=
CapaFactory
.
create
()
module
=
CapaFactory
.
create
()
...
...
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