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
c3d829f2
Commit
c3d829f2
authored
Jul 26, 2016
by
Sanford Student
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding query counts
parent
d9e0ba45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
lms/djangoapps/course_api/blocks/transformers/tests/test_milestones.py
+9
-7
No files found.
lms/djangoapps/course_api/blocks/transformers/tests/test_milestones.py
View file @
c3d829f2
...
...
@@ -10,8 +10,8 @@ from lms.djangoapps.course_blocks.transformers.tests.helpers import CourseStruct
from
milestones.tests.utils
import
MilestonesTestCaseMixin
from
opaque_keys.edx.keys
import
UsageKey
from
openedx.core.lib.gating
import
api
as
gating_api
from
request_cache.middleware
import
RequestCache
from
student.tests.factories
import
CourseEnrollmentFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
..milestones
import
MilestonesTransformer
from
...api
import
get_course_blocks
...
...
@@ -20,7 +20,7 @@ from ...api import get_course_blocks
@attr
(
'shard_3'
)
@ddt.ddt
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'ENABLE_SPECIAL_EXAMS'
:
True
,
'MILESTONES_APP'
:
True
})
class
MilestonesTransformerTestCase
(
CourseStructureTestCase
,
MilestonesTestCaseMixin
):
class
MilestonesTransformerTestCase
(
CourseStructureTestCase
,
MilestonesTestCaseMixin
,
ModuleStoreTestCase
):
"""
Test behavior of ProctoredExamTransformer
"""
...
...
@@ -159,10 +159,12 @@ class MilestonesTransformerTestCase(CourseStructureTestCase, MilestonesTestCaseM
"""
self
.
course
.
enable_subsection_gating
=
True
self
.
setup_gated_section
(
self
.
blocks
[
gated_block_ref
],
self
.
blocks
[
gating_block_ref
])
self
.
get_blocks_and_check_against_expected
(
self
.
user
,
expected_blocks_before_completion
)
# We clear the request cache to simulate a new request in the LMS.
RequestCache
.
clear_request_cache
()
with
self
.
assertNumQueries
(
3
):
self
.
get_blocks_and_check_against_expected
(
self
.
user
,
expected_blocks_before_completion
)
# clear the request cache to simulate a new request
self
.
clear_caches
()
# mock the api that the lms gating api calls to get the score for each block to always return 1 (ie 100%)
with
patch
(
'gating.api.get_module_score'
,
Mock
(
return_value
=
1
)):
...
...
@@ -173,8 +175,8 @@ class MilestonesTransformerTestCase(CourseStructureTestCase, MilestonesTestCaseM
self
.
course
,
UsageKey
.
from_string
(
unicode
(
self
.
blocks
[
gating_block_child
]
.
location
)),
self
.
user
.
id
)
self
.
get_blocks_and_check_against_expected
(
self
.
user
,
self
.
ALL_BLOCKS_EXCEPT_SPECIAL
)
with
self
.
assertNumQueries
(
2
):
self
.
get_blocks_and_check_against_expected
(
self
.
user
,
self
.
ALL_BLOCKS_EXCEPT_SPECIAL
)
def
test_staff_access
(
self
):
"""
...
...
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