From 8a9e965f3efdf2a3a7b859fa7c4e6babef8f857b Mon Sep 17 00:00:00 2001 From: ahtesham-quraish Date: Tue, 12 Mar 2024 12:05:05 +0500 Subject: [PATCH] fix: remove username and change the subject in emails Description: Remove username and change the subject in emails VAN-1865 --- edx_proctoring/api.py | 10 +++------- .../emails/proctoring_attempt_satisfactory_email.html | 2 +- .../emails/proctoring_attempt_submitted_email.html | 2 +- .../proctoring_attempt_unsatisfactory_email.html | 2 +- edx_proctoring/tests/test_email.py | 11 +++++------ 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/edx_proctoring/api.py b/edx_proctoring/api.py index 748ff5dce76..673c89a48ab 100644 --- a/edx_proctoring/api.py +++ b/edx_proctoring/api.py @@ -1748,16 +1748,13 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam status = exam_attempt_obj.status if status == ProctoredExamStudentAttemptStatus.submitted: template_name = 'proctoring_attempt_submitted_email.html' - email_subject = ( - _('Proctoring Review In Progress For {course_name} {exam_name}').format( - course_name=course_name, - exam_name=exam_attempt_obj.proctored_exam.exam_name - ) - ) + email_subject = 'Proctoring attempt submitted' elif status == ProctoredExamStudentAttemptStatus.verified: template_name = 'proctoring_attempt_satisfactory_email.html' + email_subject = 'Proctoring attempt verified' elif status == ProctoredExamStudentAttemptStatus.rejected: template_name = 'proctoring_attempt_unsatisfactory_email.html' + email_subject = 'Proctoring attempt rejected' else: # Don't send an email for any other attempt status codes return None @@ -1788,7 +1785,6 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam contact_url_text = contact_url body = email_template.render({ - 'username': user.username, 'course_url': course_home_url, 'course_name': course_name, 'exam_name': exam_name, diff --git a/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html b/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html index f98832eec83..56b64c86d61 100644 --- a/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html +++ b/edx_proctoring/templates/emails/proctoring_attempt_satisfactory_email.html @@ -3,7 +3,7 @@

{% block introduction %} {% blocktrans %} - Hello {{ username }}, + Hello, {% endblocktrans %} {% endblock %}

diff --git a/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html b/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html index 2107cef5e42..9997990d6a2 100644 --- a/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html +++ b/edx_proctoring/templates/emails/proctoring_attempt_submitted_email.html @@ -3,7 +3,7 @@

{% block introduction %} {% blocktrans %} - Hello {{ username }}, + Hello, {% endblocktrans %} {% endblock %}

diff --git a/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html b/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html index 14d6db42ccd..c932357799a 100644 --- a/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html +++ b/edx_proctoring/templates/emails/proctoring_attempt_unsatisfactory_email.html @@ -3,7 +3,7 @@

{% block introduction %} {% blocktrans %} - Hello {{ username }}, + Hello, {% endblocktrans %} {% endblock %}

diff --git a/edx_proctoring/tests/test_email.py b/edx_proctoring/tests/test_email.py index e9a5313b854..89c7f91a08c 100644 --- a/edx_proctoring/tests/test_email.py +++ b/edx_proctoring/tests/test_email.py @@ -54,17 +54,17 @@ def tearDown(self): @ddt.data( [ ProctoredExamStudentAttemptStatus.submitted, - 'Proctoring Review In Progress', + 'Proctoring attempt submitted', 'was submitted successfully', ], [ ProctoredExamStudentAttemptStatus.verified, - 'Proctoring Results', + 'Proctoring attempt verified', 'was reviewed and you met all proctoring requirements', ], [ ProctoredExamStudentAttemptStatus.rejected, - 'Proctoring Results', + 'Proctoring attempt rejected', 'the course team has identified one or more violations', ] ) @@ -84,11 +84,10 @@ def test_send_email(self, status, expected_subject, expected_message_string): # Verify the subject actual_subject = self._normalize_whitespace(mail.outbox[0].subject) self.assertIn(expected_subject, actual_subject) - self.assertIn(self.exam_name, actual_subject) # Verify the body actual_body = self._normalize_whitespace(mail.outbox[0].body) - self.assertIn('Hello tester,', actual_body) + self.assertIn('Hello,', actual_body) self.assertIn('Your proctored exam "Test Exam"', actual_body) self.assertIn(credit_state['course_name'], actual_body) self.assertIn(expected_message_string, actual_body) @@ -223,7 +222,7 @@ def test_send_email_unicode(self): # Verify the subject actual_subject = self._normalize_whitespace(mail.outbox[0].subject) - self.assertIn('Proctoring Review In Progress', actual_subject) + self.assertIn('Proctoring attempt submitted', actual_subject) self.assertIn(course_name, actual_subject) # Verify the body