Commit faa03f0e by Alexander Kryklia

Update docstrings.

parent d5639293
......@@ -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
......@@ -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 = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment