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
613652b7
Commit
613652b7
authored
Sep 21, 2016
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test: Rescoring problem updates grades accordingly
TNL-5465 TNL-802
parent
e1f5e40f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
48 deletions
+84
-48
lms/djangoapps/instructor_task/tests/test_base.py
+15
-9
lms/djangoapps/instructor_task/tests/test_integration.py
+69
-39
No files found.
lms/djangoapps/instructor_task/tests/test_base.py
View file @
613652b7
...
...
@@ -208,15 +208,24 @@ class InstructorTaskModuleTestCase(InstructorTaskCourseTestCase):
else
:
return
TEST_COURSE_KEY
.
make_usage_key
(
'problem'
,
problem_url_name
)
def
_option_problem_factory_args
(
self
,
correct_answer
=
OPTION_1
,
num_inputs
=
1
,
num_responses
=
2
):
"""
Returns the factory args for the option problem type.
"""
return
{
'question_text'
:
'The correct answer is {0}'
.
format
(
correct_answer
),
'options'
:
[
OPTION_1
,
OPTION_2
],
'correct_option'
:
correct_answer
,
'num_responses'
:
num_responses
,
'num_inputs'
:
num_inputs
,
}
def
define_option_problem
(
self
,
problem_url_name
,
parent
=
None
,
**
kwargs
):
"""Create the problem definition so the answer is Option 1"""
if
parent
is
None
:
parent
=
self
.
problem_section
factory
=
OptionResponseXMLFactory
()
factory_args
=
{
'question_text'
:
'The correct answer is {0}'
.
format
(
OPTION_1
),
'options'
:
[
OPTION_1
,
OPTION_2
],
'correct_option'
:
OPTION_1
,
'num_responses'
:
2
}
factory_args
=
self
.
_option_problem_factory_args
()
problem_xml
=
factory
.
build_xml
(
**
factory_args
)
ItemFactory
.
create
(
parent_location
=
parent
.
location
,
parent
=
parent
,
...
...
@@ -225,13 +234,10 @@ class InstructorTaskModuleTestCase(InstructorTaskCourseTestCase):
data
=
problem_xml
,
**
kwargs
)
def
redefine_option_problem
(
self
,
problem_url_name
):
def
redefine_option_problem
(
self
,
problem_url_name
,
correct_answer
=
OPTION_1
,
num_inputs
=
1
,
num_responses
=
2
):
"""Change the problem definition so the answer is Option 2"""
factory
=
OptionResponseXMLFactory
()
factory_args
=
{
'question_text'
:
'The correct answer is {0}'
.
format
(
OPTION_2
),
'options'
:
[
OPTION_1
,
OPTION_2
],
'correct_option'
:
OPTION_2
,
'num_responses'
:
2
}
factory_args
=
self
.
_option_problem_factory_args
(
correct_answer
,
num_inputs
,
num_responses
)
problem_xml
=
factory
.
build_xml
(
**
factory_args
)
location
=
InstructorTaskTestCase
.
problem_location
(
problem_url_name
)
item
=
self
.
module_store
.
get_item
(
location
)
...
...
lms/djangoapps/instructor_task/tests/test_integration.py
View file @
613652b7
This diff is collapsed.
Click to expand it.
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