Skip to content
Snippets Groups Projects
Commit f78be26a authored by Sarina Canelake's avatar Sarina Canelake
Browse files

Merge pull request #8341 from mcgachey/mcgachey-lti-consumer-bugfix

[LTI Provider] Bugfix in LtiConsumer handling code
parents f01b2f43 71ee9d3b
No related merge requests found
......@@ -62,7 +62,6 @@ class LtiConsumer(models.Model):
if not consumer:
consumer = LtiConsumer.objects.get(
consumer_key=consumer_key,
instance_guid=instance_guid if instance_guid else None
)
# Add the instance_guid field to the model if it's not there already.
......
......@@ -257,6 +257,17 @@ class LtiRunTest(TestCase):
views.lti_run(request)
self.assertNotIn(views.LTI_SESSION_KEY, request.session)
@patch('lti_provider.views.render_courseware')
def test_lti_consumer_record_supplemented_with_guid(self, _render):
request = build_run_request()
request.session[views.LTI_SESSION_KEY]['tool_consumer_instance_guid'] = 'instance_guid'
with self.assertNumQueries(4):
views.lti_run(request)
consumer = models.LtiConsumer.objects.get(
consumer_key=LTI_DEFAULT_PARAMS['oauth_consumer_key']
)
self.assertEqual(consumer.instance_guid, 'instance_guid')
class RenderCoursewareTest(TestCase):
"""
......
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