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
6ec3b94d
Commit
6ec3b94d
authored
Mar 05, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for capa module closed() method; modified
closed() to handle edge cases
parent
49784009
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletions
+47
-1
common/lib/xmodule/xmodule/capa_module.py
+1
-1
common/lib/xmodule/xmodule/tests/test_capa_module.py
+46
-0
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
6ec3b94d
...
@@ -419,7 +419,7 @@ class CapaModule(XModule):
...
@@ -419,7 +419,7 @@ class CapaModule(XModule):
def
closed
(
self
):
def
closed
(
self
):
''' Is the student still allowed to submit answers? '''
''' Is the student still allowed to submit answers? '''
if
self
.
attempts
=
=
self
.
max_attempts
:
if
self
.
max_attempts
is
not
None
and
self
.
attempts
>
=
self
.
max_attempts
:
return
True
return
True
if
self
.
is_past_due
():
if
self
.
is_past_due
():
return
True
return
True
...
...
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
6ec3b94d
...
@@ -286,6 +286,34 @@ class CapaModuleTest(unittest.TestCase):
...
@@ -286,6 +286,34 @@ class CapaModuleTest(unittest.TestCase):
self
.
assertTrue
(
still_in_grace
.
answer_available
())
self
.
assertTrue
(
still_in_grace
.
answer_available
())
def
test_closed
(
self
):
# Attempts < Max attempts --> NOT closed
module
=
CapaFactory
.
create
(
max_attempts
=
"1"
,
attempts
=
"0"
)
self
.
assertFalse
(
module
.
closed
())
# Attempts < Max attempts --> NOT closed
module
=
CapaFactory
.
create
(
max_attempts
=
"2"
,
attempts
=
"1"
)
self
.
assertFalse
(
module
.
closed
())
# Attempts = Max attempts --> closed
module
=
CapaFactory
.
create
(
max_attempts
=
"1"
,
attempts
=
"1"
)
self
.
assertTrue
(
module
.
closed
())
# Attempts > Max attempts --> closed
module
=
CapaFactory
.
create
(
max_attempts
=
"1"
,
attempts
=
"2"
)
self
.
assertTrue
(
module
.
closed
())
# Max attempts = 0 --> closed
module
=
CapaFactory
.
create
(
max_attempts
=
"0"
,
attempts
=
"2"
)
self
.
assertTrue
(
module
.
closed
())
# Past due --> closed
module
=
CapaFactory
.
create
(
max_attempts
=
"1"
,
attempts
=
"0"
,
due
=
self
.
yesterday_str
)
self
.
assertTrue
(
module
.
closed
())
def
test_parse_get_params
(
self
):
def
test_parse_get_params
(
self
):
# Valid GET param dict
# Valid GET param dict
...
@@ -522,3 +550,21 @@ class CapaModuleTest(unittest.TestCase):
...
@@ -522,3 +550,21 @@ class CapaModuleTest(unittest.TestCase):
# Expect that the problem was NOT reset
# Expect that the problem was NOT reset
self
.
assertTrue
(
'success'
in
result
and
not
result
[
'success'
])
self
.
assertTrue
(
'success'
in
result
and
not
result
[
'success'
])
def
test_save_problem
(
self
):
module
=
CapaFactory
.
create
()
# Simulate
def
test_save_problem_closed
(
self
):
self
.
fail
()
def
test_save_problem_submitted_with_randomize
(
self
):
self
.
fail
()
def
test_save_problem_submitted_no_randomize
(
self
):
self
.
fail
()
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