Skip to content
Snippets Groups Projects
Unverified Commit 8184732d authored by Dave St.Germain's avatar Dave St.Germain Committed by GitHub
Browse files

Merge pull request #91 from open-craft/ahmed/bb-2706-make-lti-consumer-indexable

[BD-29] [TNL-6993] [BB-2706] Make LTI Consumer indexable
parents 1e85e812 1a9bcab7
No related branches found
No related tags found
No related merge requests found
...@@ -1471,3 +1471,26 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock): ...@@ -1471,3 +1471,26 @@ class LtiConsumerXBlock(StudioEditableXBlockMixin, XBlock):
'lti_2_0_result_rest_handler': 'result_service_url' 'lti_2_0_result_rest_handler': 'result_service_url'
} }
return getattr(self, mapping[service_name]) return getattr(self, mapping[service_name])
def index_dictionary(self):
"""
Return dictionary prepared with module content and type for indexing.
"""
# return key/value fields in a Python dict object
# values may be numeric / string or dict
# default implementation is an empty dict
xblock_body = super(LtiConsumerXBlock, self).index_dictionary()
index_body = {
"display_name": self.display_name,
"description": self.description,
}
if "content" in xblock_body:
xblock_body["content"].update(index_body)
else:
xblock_body["content"] = index_body
xblock_body["content_type"] = "LTI Consumer"
return xblock_body
...@@ -42,6 +42,32 @@ class TestLtiConsumerXBlock(TestCase): ...@@ -42,6 +42,32 @@ class TestLtiConsumerXBlock(TestCase):
self.xblock = make_xblock('lti_consumer', LtiConsumerXBlock, self.xblock_attributes) self.xblock = make_xblock('lti_consumer', LtiConsumerXBlock, self.xblock_attributes)
class TestIndexibility(TestCase):
"""
Test indexibility of Lti Consumer XBlock
"""
def setUp(self):
super(TestIndexibility, self).setUp()
self.xblock_attributes = {
'launch_url': 'http://www.example.com',
'display_name': 'Example LTI Consumer Application',
'description': 'An example application to demonstrate LTI Consumer'
}
self.xblock = make_xblock('lti_consumer', LtiConsumerXBlock, self.xblock_attributes)
def test_indexibility(self):
self.assertEqual(
self.xblock.index_dictionary(),
{
'content_type': 'LTI Consumer',
'content': {
'display_name': 'Example LTI Consumer Application',
'description': 'An example application to demonstrate LTI Consumer'
}
}
)
class TestProperties(TestLtiConsumerXBlock): class TestProperties(TestLtiConsumerXBlock):
""" """
Unit tests for LtiConsumerXBlock properties Unit tests for LtiConsumerXBlock properties
......
...@@ -49,7 +49,7 @@ with open('README.rst') as _f: ...@@ -49,7 +49,7 @@ with open('README.rst') as _f:
setup( setup(
name='lti-consumer-xblock', name='lti-consumer-xblock',
version='2.0.4', version='2.1.0',
description='This XBlock implements the consumer side of the LTI specification.', description='This XBlock implements the consumer side of the LTI specification.',
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment