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
3a6fbae6
Commit
3a6fbae6
authored
Jan 25, 2016
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder transformers to fix MA-1981.
parent
55b7fa49
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletions
+16
-1
lms/djangoapps/course_api/blocks/api.py
+2
-1
lms/djangoapps/course_api/blocks/tests/test_api.py
+14
-0
No files found.
lms/djangoapps/course_api/blocks/api.py
View file @
3a6fbae6
...
...
@@ -52,9 +52,10 @@ def get_blocks(
)
# list of transformers to apply, adding user-specific ones if user is provided
transformers
=
[
blocks_api_transformer
]
transformers
=
[]
if
user
is
not
None
:
transformers
+=
COURSE_BLOCK_ACCESS_TRANSFORMERS
+
[
ProctoredExamTransformer
()]
transformers
+=
[
blocks_api_transformer
]
blocks
=
get_course_blocks
(
user
,
...
...
lms/djangoapps/course_api/blocks/tests/test_api.py
View file @
3a6fbae6
...
...
@@ -42,3 +42,17 @@ class TestGetBlocks(SharedModuleStoreTestCase):
def
test_no_user
(
self
):
blocks
=
get_blocks
(
self
.
request
,
self
.
course
.
location
)
self
.
assertIn
(
unicode
(
self
.
html_block
.
location
),
blocks
[
'blocks'
])
def
test_access_before_api_transformer_order
(
self
):
"""
Tests the order of transformers: access checks are made before the api
transformer is applied.
"""
blocks
=
get_blocks
(
self
.
request
,
self
.
course
.
location
,
self
.
user
,
nav_depth
=
5
,
requested_fields
=
[
'nav_depth'
])
vertical_block
=
self
.
store
.
get_item
(
self
.
course
.
id
.
make_usage_key
(
'vertical'
,
'vertical_x1a'
))
problem_block
=
self
.
store
.
get_item
(
self
.
course
.
id
.
make_usage_key
(
'problem'
,
'problem_x1a_1'
))
vertical_descendants
=
blocks
[
'blocks'
][
unicode
(
vertical_block
.
location
)][
'descendants'
]
self
.
assertIn
(
unicode
(
problem_block
.
location
),
vertical_descendants
)
self
.
assertNotIn
(
unicode
(
self
.
html_block
.
location
),
vertical_descendants
)
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