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
d66e6cbc
Commit
d66e6cbc
authored
Apr 08, 2014
by
Oleg Marshev
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3052 from edx/oleg/add-context-id
LTI context_id. BLD-584.
parents
be4e9cb5
8a202424
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
12 deletions
+27
-12
CHANGELOG.rst
+2
-0
common/lib/xmodule/xmodule/js/fixtures/lti.html
+1
-0
common/lib/xmodule/xmodule/lti_module.py
+13
-6
common/lib/xmodule/xmodule/tests/__init__.py
+1
-1
common/lib/xmodule/xmodule/tests/test_lti_unit.py
+6
-2
lms/djangoapps/courseware/tests/test_lti_integration.py
+4
-3
No files found.
CHANGELOG.rst
View file @
d66e6cbc
...
...
@@ -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: Add LTI context_id parameter. BLD-584.
Blades: Update LTI resource_link_id parameter. BLD-768.
Blades: Transcript translations should be displayed in their source language (BLD-935).
...
...
common/lib/xmodule/xmodule/js/fixtures/lti.html
View file @
d66e6cbc
...
...
@@ -28,6 +28,7 @@
<input
name=
"oauth_signature"
value=
"89ru3289r3ry283y3r82ryr38yr"
/>
<input
name=
"lti_message_type"
value=
"basic-lti-launch-request"
/>
<input
name=
"oauth_callback"
value=
"about:blank"
/>
<input
name=
"context_id"
value=
"testorg/testcoursename/2014"
/>
<input
type=
"submit"
value=
"Press to Launch"
/>
</form>
...
...
common/lib/xmodule/xmodule/lti_module.py
View file @
d66e6cbc
...
...
@@ -338,13 +338,9 @@ class LTIModule(LTIFields, XModule):
This value may change for a particular resource_link_id / user_id from one launch to the next.
The TP should only retain the most recent value for this field for a particular resource_link_id / user_id.
This field is generally optional, but is required for grading.
context_id is - is an opaque identifier that uniquely identifies the context that contains
the link being launched.
lti_id should be context_id by meaning.
"""
return
"{
id
}:{resource_link}:{user_id}"
.
format
(
id
=
urllib
.
quote
(
self
.
lti
_id
),
return
"{
context
}:{resource_link}:{user_id}"
.
format
(
context
=
urllib
.
quote
(
self
.
context
_id
),
resource_link
=
urllib
.
quote
(
self
.
get_resource_link_id
()),
user_id
=
urllib
.
quote
(
self
.
get_user_id
())
)
...
...
@@ -358,6 +354,16 @@ class LTIModule(LTIFields, XModule):
return
course
@property
def
context_id
(
self
):
"""
Return context_id.
context_id is an opaque identifier that uniquely identifies the context (e.g., a course)
that contains the link being launched.
"""
return
self
.
course_id
@property
def
role
(
self
):
"""
Get system user role and convert it to LTI role.
...
...
@@ -397,6 +403,7 @@ class LTIModule(LTIFields, XModule):
u'resource_link_id'
:
self
.
get_resource_link_id
(),
u'lis_result_sourcedid'
:
self
.
get_lis_result_sourcedid
(),
u'context_id'
:
self
.
context_id
,
}
if
self
.
has_score
:
...
...
common/lib/xmodule/xmodule/tests/__init__.py
View file @
d66e6cbc
...
...
@@ -131,7 +131,7 @@ class LogicTest(unittest.TestCase):
url_name
=
''
category
=
'test'
self
.
system
=
get_test_system
()
self
.
system
=
get_test_system
(
course_id
=
'test/course/id'
)
self
.
descriptor
=
EmptyClass
()
self
.
xmodule_class
=
self
.
descriptor_class
.
module_class
...
...
common/lib/xmodule/xmodule/tests/test_lti_unit.py
View file @
d66e6cbc
...
...
@@ -265,7 +265,7 @@ class LTIModuleTest(LogicTest):
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
,
self
.
system
.
course
_id
,
urllib
.
quote
(
self
.
unquoted_resource_link_id
),
self
.
user_id
))
...
...
@@ -407,4 +407,8 @@ class LTIModuleTest(LogicTest):
self
.
xmodule
.
graded
=
False
self
.
assertEqual
(
self
.
xmodule
.
max_score
(),
100.0
)
def
test_context_id
(
self
):
"""
Tests that LTI parameter context_id is equal to course_id.
"""
self
.
assertEqual
(
self
.
system
.
course_id
,
self
.
xmodule
.
context_id
)
lms/djangoapps/courseware/tests/test_lti_integration.py
View file @
d66e6cbc
...
...
@@ -27,13 +27,13 @@ class TestLTI(BaseTestXmodule):
mocked_signature_after_sign
=
u'my_signature
%3
D'
mocked_decoded_signature
=
u'my_signature='
lti_id
=
self
.
item_descriptor
.
lti
_id
context_id
=
self
.
item_descriptor
.
course
_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
),
sourcedId
=
"{
context
}:{resource_link}:{user_id}"
.
format
(
context
=
urllib
.
quote
(
context
_id
),
resource_link
=
urllib
.
quote
(
resource_link_id
),
user_id
=
urllib
.
quote
(
user_id
)
)
...
...
@@ -49,6 +49,7 @@ class TestLTI(BaseTestXmodule):
u'lti_message_type'
:
u'basic-lti-launch-request'
,
u'lti_version'
:
'LTI-1p0'
,
u'roles'
:
u'Student'
,
u'context_id'
:
context_id
,
u'resource_link_id'
:
resource_link_id
,
u'lis_result_sourcedid'
:
sourcedId
,
...
...
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