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
faa03f0e
Commit
faa03f0e
authored
Sep 05, 2013
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docstrings.
parent
d5639293
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
common/lib/xmodule/xmodule/lti_module.py
+10
-4
lms/djangoapps/courseware/tests/test_lti.py
+9
-2
No files found.
common/lib/xmodule/xmodule/lti_module.py
View file @
faa03f0e
...
...
@@ -44,7 +44,8 @@ class LTIFields(object):
class
LTIModule
(
LTIFields
,
XModule
):
'''Module provides LTI integration to course.
'''
Module provides LTI integration to course.
Except usual xmodule structure it proceeds with oauth signing.
How it works::
...
...
@@ -127,7 +128,9 @@ class LTIModule(LTIFields, XModule):
js_module_name
=
"LTI"
def
get_html
(
self
):
""" Renders parameters to template. """
"""
Renders parameters to template.
"""
# Obtains client_key and client_secret credentials from current course:
course_id
=
self
.
runtime
.
course_id
...
...
@@ -176,7 +179,8 @@ class LTIModule(LTIFields, XModule):
return
self
.
system
.
render_template
(
'lti.html'
,
context
)
def
oauth_params
(
self
,
custom_parameters
,
client_key
,
client_secret
):
"""Signs request and returns signature and oauth parameters.
"""
Signs request and returns signature and oauth parameters.
`custom_paramters` is dict of parsed `custom_parameter` field
...
...
@@ -236,5 +240,7 @@ class LTIModule(LTIFields, XModule):
class
LTIModuleDescriptor
(
LTIFields
,
MetadataOnlyEditingDescriptor
):
"""LTI Descriptor. No export/import to xml."""
"""
LTIModuleDescriptor provides no export/import to xml.
"""
module_class
=
LTIModule
lms/djangoapps/courseware/tests/test_lti.py
View file @
faa03f0e
...
...
@@ -8,6 +8,9 @@ from collections import OrderedDict
class
TestLTI
(
BaseTestXmodule
):
"""
Integration test for lti xmodule.
It checks overall code, by assuring that context that goes to template is correct.
As part of that, checks oauth signature generation by mocking signing function of `requests` library.
"""
CATEGORY
=
"lti"
...
...
@@ -42,7 +45,9 @@ class TestLTI(BaseTestXmodule):
saved_sign
=
requests
.
auth
.
Client
.
sign
def
mocked_sign
(
self
,
*
args
,
**
kwargs
):
"""Mocked oauth1 sign function"""
"""
Mocked oauth1 sign function.
"""
# self is <oauthlib.oauth1.rfc5849.Client object> here:
_
,
headers
,
_
=
saved_sign
(
self
,
*
args
,
**
kwargs
)
# we should replace noonce, timestamp and signed_signature in headers:
...
...
@@ -57,7 +62,9 @@ class TestLTI(BaseTestXmodule):
requests
.
auth
.
Client
.
sign
=
mocked_sign
def
test_lti_constructor
(
self
):
"""Make sure that all parameters extracted """
"""
Makes sure that all parameters extracted.
"""
self
.
runtime
.
render_template
=
lambda
template
,
context
:
context
generated_context
=
self
.
item_module
.
get_html
()
expected_context
=
{
...
...
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