Skip to content
Snippets Groups Projects
Unverified Commit 314cba1d authored by Varsha's avatar Varsha Committed by GitHub
Browse files

feat: add html message (#367)

parent d1220db9
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,10 @@ Please See the `releases tab <https://github.com/openedx/xblock-lti-consumer/rel
Unreleased
~~~~~~~~~~
9.5.0 - 2023-05-08
------------------
* Return HTML message telling user that exam is ready to start on start assessment response to LTI proctoring launch.
9.4.0 - 2023-05-08
------------------
* Fix broken call to LMS `get_block_for_descriptor_internal` due to descriptor->block rename.
......
......@@ -4,4 +4,4 @@ Runtime will load the XBlock class from here.
from .apps import LTIConsumerApp
from .lti_xblock import LtiConsumerXBlock
__version__ = '9.4.0'
__version__ = '9.5.0'
......@@ -21,7 +21,7 @@ from opaque_keys.edx.keys import UsageKey
from rest_framework import status, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_403_FORBIDDEN, HTTP_404_NOT_FOUND
from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST, HTTP_403_FORBIDDEN, HTTP_404_NOT_FOUND
from lti_consumer.api import get_lti_pii_sharing_state_for_course, validate_lti_1p3_launch_data
from lti_consumer.exceptions import LtiError
......@@ -834,4 +834,4 @@ def start_proctoring_assessment_endpoint(request):
user_id=request.user.id,
)
return JsonResponse(data={})
return render(request, 'html/lti_start_assessment.html', status=HTTP_200_OK)
{% load i18n %}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<title>LTI</title>
</head>
<body>
<p>
<b>{% trans "Sending you back to your exam." %}</b>
</p>
<script>
setTimeout(function () {window.close()}, 5000);
</script>
<p>
<a href="javascript:window.close();">
{% trans "Return to exam." %}
</a>
</p>
</body>
</html>
......@@ -280,3 +280,17 @@ class TestLti1p3ProctoringStartProctoringAssessmentEndpoint(TestCase):
user_id=self.user.id,
)
self.assertEqual(mock_assessment_started_signal.call_args, expected_call_args)
def test_start_assessment_endpoint_returns_valid_html(self):
"""
Tests that a successful call to the start_assessment_endpoint returns the correct html response.
"""
response = self.client.post(
self.url,
{
"JWT": self.create_tool_jwt_token()
},
)
self.assertEqual(response.status_code, 200)
self.assertIn('window.close', response.content.decode('utf-8'))
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