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
42025461
Commit
42025461
authored
Sep 22, 2016
by
Nimisha Asthagiri
Committed by
GitHub
Sep 22, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13533 from edx/beryl/integration-tests
Grades python integration tests
parents
81083570
613652b7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
57 deletions
+112
-57
lms/djangoapps/courseware/tests/test_submitting_problems.py
+28
-9
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/courseware/tests/test_submitting_problems.py
View file @
42025461
...
@@ -354,7 +354,21 @@ class TestCourseGrader(TestSubmittingProblems):
...
@@ -354,7 +354,21 @@ class TestCourseGrader(TestSubmittingProblems):
self
.
add_dropdown_to_section
(
self
.
homework
.
location
,
'p3'
,
1
)
self
.
add_dropdown_to_section
(
self
.
homework
.
location
,
'p3'
,
1
)
self
.
refresh_course
()
self
.
refresh_course
()
def
weighted_setup
(
self
):
def
weighted_setup
(
self
,
hw_weight
=
0.25
,
final_weight
=
0.75
):
"""
Set up a simple course for testing weighted grading functionality.
"""
# pylint: disable=attribute-defined-outside-init
self
.
set_weighted_policy
(
hw_weight
,
final_weight
)
# set up a structure of 1 homework and 1 final
self
.
homework
=
self
.
add_graded_section_to_course
(
'homework'
)
self
.
problem
=
self
.
add_dropdown_to_section
(
self
.
homework
.
location
,
'H1P1'
)
self
.
final
=
self
.
add_graded_section_to_course
(
'Final Section'
,
'Final'
)
self
.
final_question
=
self
.
add_dropdown_to_section
(
self
.
final
.
location
,
'FinalQuestion'
)
def
set_weighted_policy
(
self
,
hw_weight
=
0.25
,
final_weight
=
0.75
):
"""
"""
Set up a simple course for testing weighted grading functionality.
Set up a simple course for testing weighted grading functionality.
"""
"""
...
@@ -366,23 +380,17 @@ class TestCourseGrader(TestSubmittingProblems):
...
@@ -366,23 +380,17 @@ class TestCourseGrader(TestSubmittingProblems):
"min_count"
:
1
,
"min_count"
:
1
,
"drop_count"
:
0
,
"drop_count"
:
0
,
"short_label"
:
"HW"
,
"short_label"
:
"HW"
,
"weight"
:
0.25
"weight"
:
hw_weight
},
{
},
{
"type"
:
"Final"
,
"type"
:
"Final"
,
"name"
:
"Final Section"
,
"name"
:
"Final Section"
,
"short_label"
:
"Final"
,
"short_label"
:
"Final"
,
"weight"
:
0.75
"weight"
:
final_weight
}
}
]
]
}
}
self
.
add_grading_policy
(
grading_policy
)
self
.
add_grading_policy
(
grading_policy
)
# set up a structure of 1 homework and 1 final
self
.
homework
=
self
.
add_graded_section_to_course
(
'homework'
)
self
.
problem
=
self
.
add_dropdown_to_section
(
self
.
homework
.
location
,
'H1P1'
)
self
.
final
=
self
.
add_graded_section_to_course
(
'Final Section'
,
'Final'
)
self
.
final_question
=
self
.
add_dropdown_to_section
(
self
.
final
.
location
,
'FinalQuestion'
)
def
dropping_setup
(
self
):
def
dropping_setup
(
self
):
"""
"""
Set up a simple course for testing the dropping grading functionality.
Set up a simple course for testing the dropping grading functionality.
...
@@ -619,6 +627,17 @@ class TestCourseGrader(TestSubmittingProblems):
...
@@ -619,6 +627,17 @@ class TestCourseGrader(TestSubmittingProblems):
self
.
submit_question_answer
(
'FinalQuestion'
,
{
'2_1'
:
'Correct'
,
'2_2'
:
'Correct'
})
self
.
submit_question_answer
(
'FinalQuestion'
,
{
'2_1'
:
'Correct'
,
'2_2'
:
'Correct'
})
self
.
check_grade_percent
(
1.0
)
self
.
check_grade_percent
(
1.0
)
def
test_grade_updates_on_weighted_change
(
self
):
"""
Test that the course grade updates when the
assignment weights change.
"""
self
.
weighted_setup
()
self
.
submit_question_answer
(
'H1P1'
,
{
'2_1'
:
'Correct'
,
'2_2'
:
'Correct'
})
self
.
check_grade_percent
(
0.25
)
self
.
set_weighted_policy
(
0.75
,
0.25
)
self
.
check_grade_percent
(
0.75
)
def
dropping_homework_stage1
(
self
):
def
dropping_homework_stage1
(
self
):
"""
"""
Get half the first homework correct and all of the second
Get half the first homework correct and all of the second
...
...
lms/djangoapps/instructor_task/tests/test_base.py
View file @
42025461
...
@@ -208,15 +208,24 @@ class InstructorTaskModuleTestCase(InstructorTaskCourseTestCase):
...
@@ -208,15 +208,24 @@ class InstructorTaskModuleTestCase(InstructorTaskCourseTestCase):
else
:
else
:
return
TEST_COURSE_KEY
.
make_usage_key
(
'problem'
,
problem_url_name
)
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
):
def
define_option_problem
(
self
,
problem_url_name
,
parent
=
None
,
**
kwargs
):
"""Create the problem definition so the answer is Option 1"""
"""Create the problem definition so the answer is Option 1"""
if
parent
is
None
:
if
parent
is
None
:
parent
=
self
.
problem_section
parent
=
self
.
problem_section
factory
=
OptionResponseXMLFactory
()
factory
=
OptionResponseXMLFactory
()
factory_args
=
{
'question_text'
:
'The correct answer is {0}'
.
format
(
OPTION_1
),
factory_args
=
self
.
_option_problem_factory_args
()
'options'
:
[
OPTION_1
,
OPTION_2
],
'correct_option'
:
OPTION_1
,
'num_responses'
:
2
}
problem_xml
=
factory
.
build_xml
(
**
factory_args
)
problem_xml
=
factory
.
build_xml
(
**
factory_args
)
ItemFactory
.
create
(
parent_location
=
parent
.
location
,
ItemFactory
.
create
(
parent_location
=
parent
.
location
,
parent
=
parent
,
parent
=
parent
,
...
@@ -225,13 +234,10 @@ class InstructorTaskModuleTestCase(InstructorTaskCourseTestCase):
...
@@ -225,13 +234,10 @@ class InstructorTaskModuleTestCase(InstructorTaskCourseTestCase):
data
=
problem_xml
,
data
=
problem_xml
,
**
kwargs
)
**
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"""
"""Change the problem definition so the answer is Option 2"""
factory
=
OptionResponseXMLFactory
()
factory
=
OptionResponseXMLFactory
()
factory_args
=
{
'question_text'
:
'The correct answer is {0}'
.
format
(
OPTION_2
),
factory_args
=
self
.
_option_problem_factory_args
(
correct_answer
,
num_inputs
,
num_responses
)
'options'
:
[
OPTION_1
,
OPTION_2
],
'correct_option'
:
OPTION_2
,
'num_responses'
:
2
}
problem_xml
=
factory
.
build_xml
(
**
factory_args
)
problem_xml
=
factory
.
build_xml
(
**
factory_args
)
location
=
InstructorTaskTestCase
.
problem_location
(
problem_url_name
)
location
=
InstructorTaskTestCase
.
problem_location
(
problem_url_name
)
item
=
self
.
module_store
.
get_item
(
location
)
item
=
self
.
module_store
.
get_item
(
location
)
...
...
lms/djangoapps/instructor_task/tests/test_integration.py
View file @
42025461
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