From 5f5823937eb253e01ab255f9892022646e33b1ba Mon Sep 17 00:00:00 2001 From: Zacharis278 Date: Thu, 7 Dec 2023 14:32:32 -0500 Subject: [PATCH] feat: send custom_url param to LTI tool --- edx_exams/apps/lti/tests/test_views.py | 3 +++ edx_exams/apps/lti/views.py | 5 +++++ edx_exams/settings/base.py | 2 ++ edx_exams/settings/local.py | 1 + edx_exams/settings/test.py | 1 + 5 files changed, 12 insertions(+) diff --git a/edx_exams/apps/lti/tests/test_views.py b/edx_exams/apps/lti/tests/test_views.py index 0a00efb3..e76aac72 100644 --- a/edx_exams/apps/lti/tests/test_views.py +++ b/edx_exams/apps/lti/tests/test_views.py @@ -424,6 +424,9 @@ def test_start_proctoring_launch_data(self, mock_get_lti_launch_url): proctoring_launch_data=expected_proctoring_launch_data, context_id=self.course_id, context_label=self.content_id, + custom_parameters={ + 'custom_url': 'https://test.learning:2000/exam', + }, ) mock_get_lti_launch_url.assert_called_with(expected_launch_data) diff --git a/edx_exams/apps/lti/views.py b/edx_exams/apps/lti/views.py index 3983bc4e..8baed797 100644 --- a/edx_exams/apps/lti/views.py +++ b/edx_exams/apps/lti/views.py @@ -263,6 +263,11 @@ def start_proctoring(request, attempt_id): context_label=exam.content_id, ) + # temporary addition for testing with Proctorio in stage + if settings.LTI_CUSTOM_URL_CLAIM: # pragma: no cover + launch_data.custom_parameters['custom_url'] = settings.LTI_CUSTOM_URL_CLAIM + + return redirect(get_lti_1p3_launch_start_url(launch_data)) diff --git a/edx_exams/settings/base.py b/edx_exams/settings/base.py index 1b12ce02..e11a883c 100644 --- a/edx_exams/settings/base.py +++ b/edx_exams/settings/base.py @@ -280,6 +280,8 @@ def root(*path_fragments): EXAMS_DASHBOARD_MFE_URL = None +LTI_CUSTOM_URL_CLAIM = None + # Event Bus Settings EXAM_ATTEMPT_EVENTS_KAFKA_TOPIC_NAME = 'learning-exam-attempt-lifecycle' diff --git a/edx_exams/settings/local.py b/edx_exams/settings/local.py index ba38c9a9..2c3cf80e 100644 --- a/edx_exams/settings/local.py +++ b/edx_exams/settings/local.py @@ -121,6 +121,7 @@ LTI_API_BASE = 'http://localhost:18740' LMS_ROOT_URL = 'http://localhost:18000' LEARNING_MICROFRONTEND_URL = 'http://localhost:2000' +LTI_CUSTOM_URL_CLAIM = 'http://localhost:2000' EXAMS_DASHBOARD_MFE_URL = 'http://localhost:2020' CORS_ORIGIN_WHITELIST = ( diff --git a/edx_exams/settings/test.py b/edx_exams/settings/test.py index 633c37dd..40a25fe6 100644 --- a/edx_exams/settings/test.py +++ b/edx_exams/settings/test.py @@ -26,6 +26,7 @@ LTI_API_BASE = 'http://test.exams:18740' LMS_ROOT_URL = 'http://test.lms:18000' LEARNING_MICROFRONTEND_URL = 'http://test.learning:2000' +LTI_CUSTOM_URL_CLAIM = 'https://test.learning:2000/exam' TOKEN_SIGNING.update({ 'JWT_PRIVATE_SIGNING_JWK': '''{