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
3cefec63
Commit
3cefec63
authored
Aug 04, 2017
by
Tyler Hallada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix python unit tests
parent
8a851b3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
lms/djangoapps/grades/management/commands/tests/test_reset_grades.py
+4
-4
lms/djangoapps/grades/tests/test_new.py
+2
-2
lms/djangoapps/grades/tests/test_tasks.py
+8
-8
No files found.
lms/djangoapps/grades/management/commands/tests/test_reset_grades.py
View file @
3cefec63
...
...
@@ -155,7 +155,7 @@ class TestResetGrades(TestCase):
self
.
_update_or_create_grades
()
self
.
_assert_grades_exist_for_courses
(
self
.
course_keys
)
with
self
.
assertNumQueries
(
4
):
with
self
.
assertNumQueries
(
7
):
self
.
command
.
handle
(
delete
=
True
,
all_courses
=
True
)
self
.
_assert_grades_absent_for_courses
(
self
.
course_keys
)
...
...
@@ -174,7 +174,7 @@ class TestResetGrades(TestCase):
self
.
_update_or_create_grades
()
self
.
_assert_grades_exist_for_courses
(
self
.
course_keys
)
with
self
.
assertNumQueries
(
4
):
with
self
.
assertNumQueries
(
6
):
self
.
command
.
handle
(
delete
=
True
,
courses
=
[
unicode
(
course_key
)
for
course_key
in
self
.
course_keys
[:
num_courses_to_reset
]]
...
...
@@ -199,7 +199,7 @@ class TestResetGrades(TestCase):
with
freeze_time
(
self
.
_date_from_now
(
days
=
4
)):
self
.
_update_or_create_grades
(
self
.
course_keys
[:
num_courses_with_updated_grades
])
with
self
.
assertNumQueries
(
4
):
with
self
.
assertNumQueries
(
6
):
self
.
command
.
handle
(
delete
=
True
,
modified_start
=
self
.
_date_str_from_now
(
days
=
2
),
all_courses
=
True
)
self
.
_assert_grades_absent_for_courses
(
self
.
course_keys
[:
num_courses_with_updated_grades
])
...
...
@@ -214,7 +214,7 @@ class TestResetGrades(TestCase):
with
freeze_time
(
self
.
_date_from_now
(
days
=
5
)):
self
.
_update_or_create_grades
(
self
.
course_keys
[
2
:
4
])
with
self
.
assertNumQueries
(
4
):
with
self
.
assertNumQueries
(
6
):
self
.
command
.
handle
(
delete
=
True
,
modified_start
=
self
.
_date_str_from_now
(
days
=
2
),
...
...
lms/djangoapps/grades/tests/test_new.py
View file @
3cefec63
...
...
@@ -197,7 +197,7 @@ class TestCourseGradeFactory(GradeTestBase):
self
.
_update_grading_policy
(
passing
=
0.9
)
with
self
.
assertNumQueries
(
6
):
with
self
.
assertNumQueries
(
8
):
_assert_create
(
expected_pass
=
False
)
@ddt.data
(
True
,
False
)
...
...
@@ -310,7 +310,7 @@ class TestSubsectionGradeFactory(ProblemSubmissionTestMixin, GradeTestBase):
mock_get_bulk_cached_grade
.
reset_mock
()
mock_create_grade
.
reset_mock
()
with
self
.
assertNumQueries
(
0
):
with
self
.
assertNumQueries
(
1
):
grade_b
=
self
.
subsection_grade_factory
.
create
(
self
.
sequence
)
self
.
assertTrue
(
mock_get_bulk_cached_grade
.
called
)
self
.
assertFalse
(
mock_create_grade
.
called
)
...
...
lms/djangoapps/grades/tests/test_tasks.py
View file @
3cefec63
...
...
@@ -163,10 +163,10 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
self
.
assertEquals
(
mock_block_structure_create
.
call_count
,
1
)
@ddt.data
(
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
29
,
True
),
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
2
5
,
False
),
(
ModuleStoreEnum
.
Type
.
split
,
3
,
29
,
True
),
(
ModuleStoreEnum
.
Type
.
split
,
3
,
2
5
,
False
),
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
30
,
True
),
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
2
6
,
False
),
(
ModuleStoreEnum
.
Type
.
split
,
3
,
30
,
True
),
(
ModuleStoreEnum
.
Type
.
split
,
3
,
2
6
,
False
),
)
@ddt.unpack
def
test_query_counts
(
self
,
default_store
,
num_mongo_calls
,
num_sql_calls
,
create_multiple_subsections
):
...
...
@@ -178,8 +178,8 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
self
.
_apply_recalculate_subsection_grade
()
@ddt.data
(
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
29
),
(
ModuleStoreEnum
.
Type
.
split
,
3
,
29
),
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
30
),
(
ModuleStoreEnum
.
Type
.
split
,
3
,
30
),
)
@ddt.unpack
def
test_query_counts_dont_change_with_more_content
(
self
,
default_store
,
num_mongo_calls
,
num_sql_calls
):
...
...
@@ -239,8 +239,8 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
self
.
assertEqual
(
len
(
PersistentSubsectionGrade
.
bulk_read_grades
(
self
.
user
.
id
,
self
.
course
.
id
)),
0
)
@ddt.data
(
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
2
6
),
(
ModuleStoreEnum
.
Type
.
split
,
3
,
2
6
),
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
2
7
),
(
ModuleStoreEnum
.
Type
.
split
,
3
,
2
7
),
)
@ddt.unpack
def
test_persistent_grades_enabled_on_course
(
self
,
default_store
,
num_mongo_queries
,
num_sql_queries
):
...
...
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