From 8c6567462a3ae3b0ff9598d4d0533734ab3230b8 Mon Sep 17 00:00:00 2001 From: Giovanni Cimolin da Silva <giovannicimolin@gmail.com> Date: Wed, 9 Feb 2022 13:38:35 -0300 Subject: [PATCH] fix: Fix LTI 1.1 template rendering on LTI 1.1 embeds --- README.rst | 5 +++++ lti_consumer/__init__.py | 2 +- lti_consumer/lti_1p1/contrib/django.py | 2 +- lti_consumer/lti_1p1/contrib/tests/test_django.py | 8 ++++---- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index e6a3cb7..605a3bf 100644 --- a/README.rst +++ b/README.rst @@ -367,6 +367,11 @@ Changelog Please See the [releases tab](https://github.com/edx/xblock-lti-consumer/releases) for the complete changelog. +3.4.3 - 2022-02-01 +------------------ + +* Fix LTI 1.1 template rendering when using embeds in the platform + 3.4.2 - 2022-02-01 ------------------ diff --git a/lti_consumer/__init__.py b/lti_consumer/__init__.py index 387377e..f8fb0f6 100644 --- a/lti_consumer/__init__.py +++ b/lti_consumer/__init__.py @@ -4,4 +4,4 @@ Runtime will load the XBlock class from here. from .apps import LTIConsumerApp from .lti_xblock import LtiConsumerXBlock -__version__ = '3.4.2' +__version__ = '3.4.3' diff --git a/lti_consumer/lti_1p1/contrib/django.py b/lti_consumer/lti_1p1/contrib/django.py index eef2dac..7976f9e 100644 --- a/lti_consumer/lti_1p1/contrib/django.py +++ b/lti_consumer/lti_1p1/contrib/django.py @@ -125,5 +125,5 @@ def lti_embed( # Render the form template and return the template loader = ResourceLoader(__name__) - template = loader.render_mako_template('../../templates/html/lti_launch.html', context) + template = loader.render_django_template('../../templates/html/lti_launch.html', context) return template diff --git a/lti_consumer/lti_1p1/contrib/tests/test_django.py b/lti_consumer/lti_1p1/contrib/tests/test_django.py index 3925478..5ff4cdd 100644 --- a/lti_consumer/lti_1p1/contrib/tests/test_django.py +++ b/lti_consumer/lti_1p1/contrib/tests/test_django.py @@ -105,10 +105,10 @@ class TestLtiEmbed(TestCase): mock_set_custom_parameters.assert_called_with(expected_custom_parameters) @patch('lti_consumer.lti_1p1.contrib.django.LtiConsumer1p1.generate_launch_request', Mock(return_value={'a': 1})) - @patch('lti_consumer.lti_1p1.contrib.django.ResourceLoader.render_mako_template') - def test_make_template_rendered_with_correct_context_and_returned(self, mock_render_mako_template): + @patch('lti_consumer.lti_1p1.contrib.django.ResourceLoader.render_django_template') + def test_make_template_rendered_with_correct_context_and_returned(self, mock_render_django_template): fake_template = 'SOME_TEMPLATE' - mock_render_mako_template.return_value = fake_template + mock_render_django_template.return_value = fake_template rendered_template = lti_embed( html_element_id=self.html_element_id, @@ -132,5 +132,5 @@ class TestLtiEmbed(TestCase): 'launch_url': self.lti_launch_url, 'lti_parameters': {'a': 1} } - mock_render_mako_template.assert_called_with(ANY, expected_context) + mock_render_django_template.assert_called_with(ANY, expected_context) self.assertEqual(rendered_template, fake_template) -- GitLab