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
be4e9cb5
Commit
be4e9cb5
authored
Apr 08, 2014
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3040 from edx/oleg/fix-resource-link-id
LTI resource_link_id. BLD-768.
parents
28f366a9
882a1e0f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
13 deletions
+38
-13
CHANGELOG.rst
+2
-0
common/lib/xmodule/xmodule/lti_module.py
+19
-1
common/lib/xmodule/xmodule/tests/test_lti_unit.py
+12
-8
lms/djangoapps/courseware/tests/test_lti_integration.py
+5
-4
No files found.
CHANGELOG.rst
View file @
be4e9cb5
...
...
@@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected.
Blades: Update LTI resource_link_id parameter. BLD-768.
Blades: Transcript translations should be displayed in their source language (BLD-935).
Blades: Create an upload modal for video transcript translations (BLD-751).
...
...
common/lib/xmodule/xmodule/lti_module.py
View file @
be4e9cb5
...
...
@@ -309,8 +309,26 @@ class LTIModule(LTIFields, XModule):
context and imported into another system or context.
This parameter is required.
Example: u'edx.org-i4x-2-3-lti-31de800015cf4afb973356dbe81496df'
Hostname, edx.org,
makes resource_link_id change on import to another system.
Last part of location, location.name - 31de800015cf4afb973356dbe81496df,
is random hash, updated by course_id,
this makes resource_link_id unique inside single course.
First part of location is tag-org-course-category, i4x-2-3-lti.
Location.name itself does not change on import to another course,
but org and course_id change.
So together with org and course_id in a form of
i4x-2-3-lti-31de800015cf4afb973356dbe81496df this part of resource_link_id:
makes resource_link_id to be unique among courses inside same system.
"""
return
unicode
(
urllib
.
quote
(
self
.
id
))
return
unicode
(
urllib
.
quote
(
"{}-{}"
.
format
(
self
.
system
.
hostname
,
self
.
location
.
html_id
())
))
def
get_lis_result_sourcedid
(
self
):
"""
...
...
common/lib/xmodule/xmodule/tests/test_lti_unit.py
View file @
be4e9cb5
...
...
@@ -59,9 +59,9 @@ class LTIModuleTest(LogicTest):
self
.
user_id
=
self
.
xmodule
.
runtime
.
anonymous_student_id
self
.
lti_id
=
self
.
xmodule
.
lti_id
self
.
module_id
=
'//MITx/999/lti/'
self
.
unquoted_resource_link_id
=
u'{}-i4x-2-3-lti-31de800015cf4afb973356dbe81496df'
.
format
(
self
.
xmodule
.
runtime
.
hostname
)
sourcedId
=
u':'
.
join
(
urllib
.
quote
(
i
)
for
i
in
(
self
.
lti_id
,
self
.
module
_id
,
self
.
user_id
))
sourcedId
=
u':'
.
join
(
urllib
.
quote
(
i
)
for
i
in
(
self
.
lti_id
,
self
.
unquoted_resource_link
_id
,
self
.
user_id
))
self
.
DEFAULTS
=
{
'sourcedId'
:
sourcedId
,
...
...
@@ -255,16 +255,20 @@ class LTIModuleTest(LogicTest):
self
.
assertEqual
(
real_outcome_service_url
,
expected_outcome_service_url
)
def
test_resource_link_id
(
self
):
with
patch
(
'xmodule.lti_module.LTIModule.
id'
,
new_callable
=
PropertyMock
)
as
mock_id
:
mock_id
.
return_value
=
self
.
module_id
expected_resource_link_id
=
unicode
(
urllib
.
quote
(
self
.
module
_id
))
with
patch
(
'xmodule.lti_module.LTIModule.
location'
,
new_callable
=
PropertyMock
)
as
mock_location
:
self
.
xmodule
.
location
.
html_id
=
lambda
:
'i4x-2-3-lti-31de800015cf4afb973356dbe81496df'
expected_resource_link_id
=
unicode
(
urllib
.
quote
(
self
.
unquoted_resource_link
_id
))
real_resource_link_id
=
self
.
xmodule
.
get_resource_link_id
()
self
.
assertEqual
(
real_resource_link_id
,
expected_resource_link_id
)
def
test_lis_result_sourcedid
(
self
):
with
patch
(
'xmodule.lti_module.LTIModule.id'
,
new_callable
=
PropertyMock
)
as
mock_id
:
mock_id
.
return_value
=
self
.
module_id
expected_sourcedId
=
u':'
.
join
(
urllib
.
quote
(
i
)
for
i
in
(
self
.
lti_id
,
self
.
module_id
,
self
.
user_id
))
with
patch
(
'xmodule.lti_module.LTIModule.location'
,
new_callable
=
PropertyMock
)
as
mock_location
:
self
.
xmodule
.
location
.
html_id
=
lambda
:
'i4x-2-3-lti-31de800015cf4afb973356dbe81496df'
expected_sourcedId
=
u':'
.
join
(
urllib
.
quote
(
i
)
for
i
in
(
self
.
lti_id
,
urllib
.
quote
(
self
.
unquoted_resource_link_id
),
self
.
user_id
))
real_lis_result_sourcedid
=
self
.
xmodule
.
get_lis_result_sourcedid
()
self
.
assertEqual
(
real_lis_result_sourcedid
,
expected_sourcedId
)
...
...
lms/djangoapps/courseware/tests/test_lti_integration.py
View file @
be4e9cb5
...
...
@@ -28,17 +28,18 @@ class TestLTI(BaseTestXmodule):
mocked_decoded_signature
=
u'my_signature='
lti_id
=
self
.
item_descriptor
.
lti_id
module_id
=
unicode
(
urllib
.
quote
(
self
.
item_descriptor
.
id
))
user_id
=
unicode
(
self
.
item_descriptor
.
xmodule_runtime
.
anonymous_student_id
)
hostname
=
self
.
item_descriptor
.
xmodule_runtime
.
hostname
resource_link_id
=
unicode
(
urllib
.
quote
(
'{}-{}'
.
format
(
hostname
,
self
.
item_descriptor
.
location
.
html_id
())))
sourcedId
=
"{id}:{resource_link}:{user_id}"
.
format
(
id
=
urllib
.
quote
(
lti_id
),
resource_link
=
urllib
.
quote
(
module
_id
),
resource_link
=
urllib
.
quote
(
resource_link
_id
),
user_id
=
urllib
.
quote
(
user_id
)
)
lis_outcome_service_url
=
'https://{host}{path}'
.
format
(
host
=
self
.
item_descriptor
.
xmodule_runtime
.
hostname
,
host
=
hostname
,
path
=
self
.
item_descriptor
.
xmodule_runtime
.
handler_url
(
self
.
item_descriptor
,
'grade_handler'
,
thirdparty
=
True
)
.
rstrip
(
'/?'
)
)
self
.
correct_headers
=
{
...
...
@@ -49,7 +50,7 @@ class TestLTI(BaseTestXmodule):
u'lti_version'
:
'LTI-1p0'
,
u'roles'
:
u'Student'
,
u'resource_link_id'
:
module
_id
,
u'resource_link_id'
:
resource_link
_id
,
u'lis_result_sourcedid'
:
sourcedId
,
u'oauth_nonce'
:
mocked_nonce
,
...
...
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