Skip to content

Commit 314cba1

Browse files
authored
feat: add html message (#367)
1 parent d1220db commit 314cba1

5 files changed

Lines changed: 42 additions & 3 deletions

File tree

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Please See the `releases tab <https://github.com/openedx/xblock-lti-consumer/rel
1616
Unreleased
1717
~~~~~~~~~~
1818

19+
9.5.0 - 2023-05-08
20+
------------------
21+
* Return HTML message telling user that exam is ready to start on start assessment response to LTI proctoring launch.
22+
1923
9.4.0 - 2023-05-08
2024
------------------
2125
* Fix broken call to LMS `get_block_for_descriptor_internal` due to descriptor->block rename.

lti_consumer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
from .apps import LTIConsumerApp
55
from .lti_xblock import LtiConsumerXBlock
66

7-
__version__ = '9.4.0'
7+
__version__ = '9.5.0'

lti_consumer/plugin/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from rest_framework import status, viewsets
2222
from rest_framework.decorators import action
2323
from rest_framework.response import Response
24-
from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_403_FORBIDDEN, HTTP_404_NOT_FOUND
24+
from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST, HTTP_403_FORBIDDEN, HTTP_404_NOT_FOUND
2525

2626
from lti_consumer.api import get_lti_pii_sharing_state_for_course, validate_lti_1p3_launch_data
2727
from lti_consumer.exceptions import LtiError
@@ -834,4 +834,4 @@ def start_proctoring_assessment_endpoint(request):
834834
user_id=request.user.id,
835835
)
836836

837-
return JsonResponse(data={})
837+
return render(request, 'html/lti_start_assessment.html', status=HTTP_200_OK)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{% load i18n %}
2+
<!DOCTYPE html>
3+
<html>
4+
<head>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
6+
<title>LTI</title>
7+
</head>
8+
<body>
9+
<p>
10+
<b>{% trans "Sending you back to your exam." %}</b>
11+
</p>
12+
<script>
13+
setTimeout(function () {window.close()}, 5000);
14+
</script>
15+
<p>
16+
<a href="javascript:window.close();">
17+
{% trans "Return to exam." %}
18+
</a>
19+
</p>
20+
</body>
21+
</html>

lti_consumer/tests/unit/plugin/test_proctoring.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,17 @@ def test_lti_1p3_proctoring_assessment_started_signal(self, mock_assessment_star
280280
user_id=self.user.id,
281281
)
282282
self.assertEqual(mock_assessment_started_signal.call_args, expected_call_args)
283+
284+
def test_start_assessment_endpoint_returns_valid_html(self):
285+
"""
286+
Tests that a successful call to the start_assessment_endpoint returns the correct html response.
287+
"""
288+
response = self.client.post(
289+
self.url,
290+
{
291+
"JWT": self.create_tool_jwt_token()
292+
},
293+
)
294+
295+
self.assertEqual(response.status_code, 200)
296+
self.assertIn('window.close', response.content.decode('utf-8'))

0 commit comments

Comments
 (0)