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
4323109c
Commit
4323109c
authored
Jun 12, 2015
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Specified number of mongo and split calls in xblock outline handler test with ddt.
PLAT-674
parent
f73b68d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
cms/djangoapps/contentstore/views/item.py
+1
-1
cms/djangoapps/contentstore/views/tests/test_item.py
+11
-6
No files found.
cms/djangoapps/contentstore/views/item.py
View file @
4323109c
...
...
@@ -333,7 +333,7 @@ def xblock_outline_handler(request, usage_key_string):
if
response_format
==
'json'
or
'application/json'
in
request
.
META
.
get
(
'HTTP_ACCEPT'
,
'application/json'
):
store
=
modulestore
()
with
store
.
bulk_operations
(
usage_key
.
course_key
):
root_xblock
=
store
.
get_item
(
usage_key
)
root_xblock
=
store
.
get_item
(
usage_key
,
depth
=
None
)
return
JsonResponse
(
create_xblock_info
(
root_xblock
,
include_child_info
=
True
,
...
...
cms/djangoapps/contentstore/views/tests/test_item.py
View file @
4323109c
...
...
@@ -1384,6 +1384,7 @@ class TestComponentTemplates(CourseTestCase):
self
.
assertEqual
(
template_display_names
,
[
'Annotation'
,
'Open Response Assessment'
,
'Peer Grading Interface'
])
@ddt.ddt
class
TestXBlockInfo
(
ItemTest
):
"""
Unit tests for XBlock's outline handling.
...
...
@@ -1410,15 +1411,19 @@ class TestXBlockInfo(ItemTest):
json_response
=
json
.
loads
(
resp
.
content
)
self
.
validate_course_xblock_info
(
json_response
,
course_outline
=
True
)
def
test_xblock_outline_handler_mongo_calls
(
self
):
expected_calls
=
5
with
self
.
store
.
default_store
(
ModuleStoreEnum
.
Type
.
split
):
@ddt.data
(
(
ModuleStoreEnum
.
Type
.
split
,
5
,
5
),
(
ModuleStoreEnum
.
Type
.
mongo
,
4
,
6
),
)
@ddt.unpack
def
test_xblock_outline_handler_mongo_calls
(
self
,
store_type
,
chapter_queries
,
chapter_queries_1
):
with
self
.
store
.
default_store
(
store_type
):
course
=
CourseFactory
.
create
()
chapter
=
ItemFactory
.
create
(
parent_location
=
course
.
location
,
category
=
'chapter'
,
display_name
=
'Week 1'
)
outline_url
=
reverse_usage_url
(
'xblock_outline_handler'
,
chapter
.
location
)
with
check_mongo_calls
(
expected_call
s
):
with
check_mongo_calls
(
chapter_querie
s
):
self
.
client
.
get
(
outline_url
,
HTTP_ACCEPT
=
'application/json'
)
sequential
=
ItemFactory
.
create
(
...
...
@@ -1428,8 +1433,8 @@ class TestXBlockInfo(ItemTest):
ItemFactory
.
create
(
parent_location
=
sequential
.
location
,
category
=
'vertical'
,
display_name
=
'Vertical 1'
)
# calls should be same after adding two new children.
with
check_mongo_calls
(
expected_calls
):
# calls should be same after adding two new children
for split only
.
with
check_mongo_calls
(
chapter_queries_1
):
self
.
client
.
get
(
outline_url
,
HTTP_ACCEPT
=
'application/json'
)
def
test_entrance_exam_chapter_xblock_info
(
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