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
9249bafd
Commit
9249bafd
authored
Feb 11, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test of a bad answer also.
parent
e69a0731
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
lms/djangoapps/courseware/tests/tests.py
+24
-14
No files found.
lms/djangoapps/courseware/tests/tests.py
View file @
9249bafd
...
@@ -841,6 +841,13 @@ class TestSubmittingProblems(LoginEnrollmentTestCase):
...
@@ -841,6 +841,13 @@ class TestSubmittingProblems(LoginEnrollmentTestCase):
}
}
)
)
def
reset_question_answer
(
self
,
problem_url_name
):
'''resets specified problem for current user'''
problem_location
=
self
.
problem_location
(
problem_url_name
)
modx_url
=
self
.
modx_url
(
problem_location
,
'problem_reset'
)
resp
=
self
.
client
.
post
(
modx_url
)
return
resp
class
TestCourseGrader
(
TestSubmittingProblems
):
class
TestCourseGrader
(
TestSubmittingProblems
):
"""Check that a course gets graded properly"""
"""Check that a course gets graded properly"""
...
@@ -896,16 +903,6 @@ class TestCourseGrader(TestSubmittingProblems):
...
@@ -896,16 +903,6 @@ class TestCourseGrader(TestSubmittingProblems):
'input_i4x-edX-graded-problem-
%
s_2_1'
%
problem_url_name
:
responses
[
0
],
'input_i4x-edX-graded-problem-
%
s_2_1'
%
problem_url_name
:
responses
[
0
],
'input_i4x-edX-graded-problem-
%
s_2_2'
%
problem_url_name
:
responses
[
1
],
'input_i4x-edX-graded-problem-
%
s_2_2'
%
problem_url_name
:
responses
[
1
],
})
})
print
"modx_url"
,
modx_url
,
"responses"
,
responses
print
"resp"
,
resp
return
resp
def
reset_question_answer
(
self
,
problem_url_name
):
'''resets specified problem for current user'''
problem_location
=
self
.
problem_location
(
problem_url_name
)
modx_url
=
self
.
modx_url
(
problem_location
,
'problem_reset'
)
resp
=
self
.
client
.
post
(
modx_url
)
return
resp
return
resp
def
test_get_graded
(
self
):
def
test_get_graded
(
self
):
...
@@ -974,7 +971,7 @@ class TestCourseGrader(TestSubmittingProblems):
...
@@ -974,7 +971,7 @@ class TestCourseGrader(TestSubmittingProblems):
@override_settings
(
MODULESTORE
=
TEST_DATA_XML_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_XML_MODULESTORE
)
class
TestSchematicResponse
(
TestSubmittingProblems
):
class
TestSchematicResponse
(
TestSubmittingProblems
):
"""Check that
a course gets graded properly
"""
"""Check that
we can submit a schematic response, and it answers properly.
"""
course_slug
=
"embedded_python"
course_slug
=
"embedded_python"
course_when
=
"2013_Spring"
course_when
=
"2013_Spring"
...
@@ -986,9 +983,6 @@ class TestSchematicResponse(TestSubmittingProblems):
...
@@ -986,9 +983,6 @@ class TestSchematicResponse(TestSubmittingProblems):
resp
=
self
.
client
.
post
(
modx_url
,
{
resp
=
self
.
client
.
post
(
modx_url
,
{
'input_i4x-edX-embedded_python-problem-{0}_2_1'
.
format
(
problem_url_name
):
json
.
dumps
(
responses
),
'input_i4x-edX-embedded_python-problem-{0}_2_1'
.
format
(
problem_url_name
):
json
.
dumps
(
responses
),
})
})
print
"modx_url"
,
modx_url
,
"responses"
,
responses
print
"resp"
,
resp
return
resp
return
resp
def
test_get_graded
(
self
):
def
test_get_graded
(
self
):
...
@@ -1006,3 +1000,19 @@ class TestSchematicResponse(TestSubmittingProblems):
...
@@ -1006,3 +1000,19 @@ class TestSchematicResponse(TestSubmittingProblems):
)
)
respdata
=
json
.
loads
(
resp
.
content
)
respdata
=
json
.
loads
(
resp
.
content
)
self
.
assertEqual
(
respdata
[
'success'
],
'correct'
)
self
.
assertEqual
(
respdata
[
'success'
],
'correct'
)
self
.
reset_question_answer
(
'H1P1'
)
resp
=
self
.
submit_question_answer
(
'H1P1'
,
[[
'transient'
,
{
'Z'
:
[
[
0.0000004
,
2.8
],
[
0.0000009
,
0.0
],
# wrong.
[
0.0000014
,
2.8
],
[
0.0000019
,
2.8
],
[
0.0000024
,
2.8
],
[
0.0000029
,
0.2
],
[
0.0000034
,
0.2
],
[
0.0000039
,
0.2
]
]}]]
)
respdata
=
json
.
loads
(
resp
.
content
)
self
.
assertEqual
(
respdata
[
'success'
],
'incorrect'
)
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