Skip to content

Commit

Permalink
Merge pull request #653 from edx/schen/email_template_again
Browse files Browse the repository at this point in the history
Re-introduce the email template change
  • Loading branch information
schenedx authored Feb 20, 2020
2 parents e14f663 + 3944d52 commit 04f9d79
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 53 deletions.
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
from __future__ import absolute_import

# Be sure to update the version number in edx_proctoring/package.json
__version__ = '2.2.6'
__version__ = '2.2.7'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
9 changes: 5 additions & 4 deletions edx_proctoring/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,9 +1145,10 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam
course_name=course_name,
username=user.username,
)

exam = get_exam_by_id(exam_attempt_obj.proctored_exam.id)
contact_email = get_integration_specific_email(get_backend_provider(exam))
contact_url = '{scheme}://{site_name}/support/contact_us'.format(
scheme=scheme,
site_name=constants.SITE_NAME
)

body = email_template.render({
'username': user.username,
Expand All @@ -1156,8 +1157,8 @@ def create_proctoring_attempt_status_email(user_id, exam_attempt_obj, course_nam
'exam_name': exam_name,
'status': status,
'platform': constants.PLATFORM_NAME,
'contact_email': contact_email,
'support_email_subject': support_email_subject,
'contact_url': contact_url,
})

email = EmailMessage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
{% blocktrans %}
Your proctored exam "{{ exam_name }}" in
<a href="{{ course_url }}">{{ course_name }}</a> was reviewed and you
met all exam requirements.
met all proctoring requirements.
{% endblocktrans %}
</p>
<p>
{% blocktrans %}
If you have any questions about your results, contact {{ platform }}
support at
<a href="mailto:{{ contact_email }}?Subject={{ support_email_subject }}">
{{ contact_email }}
If you have any questions about your results, you can reach edX Support at
<a href="{{contact_url}}">
{{ contact_url }}
</a>.
{% endblocktrans %}
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,8 @@
{% blocktrans %}
Your proctored exam "{{ exam_name }}" in
<a href="{{ course_url }}">{{ course_name }}</a> was submitted
successfully and will now be reviewed to ensure all proctoring exam
rules were followed. You should receive an email with your updated exam
successfully and will now be reviewed to ensure all exam
rules were followed. You should receive an email with your exam
status within 5 business days.
{% endblocktrans %}
</p>
<p>
{% blocktrans %}
If you have any questions about proctoring, contact {{ platform }}
support at
<a href="mailto:{{ contact_email }}?Subject={{ support_email_subject }}">
{{ contact_email }}
</a>.
{% endblocktrans %}
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@
{% blocktrans %}
Your proctored exam "{{ exam_name }}" in
<a href="{{ course_url }}">{{ course_name }}</a> was reviewed and the
team identified one or more violations of the proctored exam rules. Examples
course team has identified one or more violations of the proctored exam rules. Examples
of issues that may result in a rules violation include browsing
the internet, blurry or missing photo identification, using a phone,
or getting help from another person. As a result of the identified issue(s),
you did not successfully meet the proctored
exam requirements.
you did not successfully meet the proctored exam requirements.
{% endblocktrans %}
</p>
<p>
{% blocktrans %}
If you have any questions about your results, contact {{ platform }}
support at
<a href="mailto:{{ contact_email }}?Subject={{ support_email_subject }}">
{{ contact_email }}
To appeal your proctored exam results, please reach out to edX Support with any relevant information
about your exam at
<a href="{{contact_url}}">
{{ contact_url }}
</a>.
{% endblocktrans %}
</p>
35 changes: 11 additions & 24 deletions edx_proctoring/tests/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from django.core import mail

from edx_proctoring.api import get_integration_specific_email, update_attempt_status
from edx_proctoring.backends import get_backend_provider
from edx_proctoring.api import update_attempt_status
from edx_proctoring.constants import SITE_NAME
from edx_proctoring.runtime import get_runtime_service, set_runtime_service
from edx_proctoring.statuses import ProctoredExamStudentAttemptStatus

Expand Down Expand Up @@ -52,12 +52,12 @@ def tearDown(self):
[
ProctoredExamStudentAttemptStatus.verified,
'Proctoring Results',
'was reviewed and you met all exam requirements',
'was reviewed and you met all proctoring requirements',
],
[
ProctoredExamStudentAttemptStatus.rejected,
'Proctoring Results',
'the team identified one or more violations',
'the course team has identified one or more violations',
]
)
@ddt.unpack
Expand Down Expand Up @@ -176,34 +176,21 @@ def test_not_send_email_timed_exam(self, status):
self.assertEqual(len(mail.outbox), 0)

@ddt.data(
[ProctoredExamStudentAttemptStatus.submitted, '[email protected]'],
[ProctoredExamStudentAttemptStatus.submitted, ''],
[ProctoredExamStudentAttemptStatus.submitted, None],
[ProctoredExamStudentAttemptStatus.verified, '[email protected]'],
[ProctoredExamStudentAttemptStatus.verified, ''],
[ProctoredExamStudentAttemptStatus.verified, None],
[ProctoredExamStudentAttemptStatus.rejected, '[email protected]'],
[ProctoredExamStudentAttemptStatus.rejected, ''],
[ProctoredExamStudentAttemptStatus.rejected, None],
[ProctoredExamStudentAttemptStatus.verified],
[ProctoredExamStudentAttemptStatus.rejected],
)
@ddt.unpack
def test_correct_edx_email(self, status, integration_specific_email,):
def test_correct_edx_support_url(self, status):
exam_attempt = self._create_started_exam_attempt()

test_backend = get_backend_provider(name='test')

test_backend.integration_specific_email = integration_specific_email

update_attempt_status(
exam_attempt.proctored_exam_id,
self.user.id,
status
)

# Verify the edX email
expected_email = get_integration_specific_email(test_backend)
# Verify the edX support URL
contact_url = 'http://{site_name}/support/contact_us'.format(site_name=SITE_NAME)
actual_body = self._normalize_whitespace(mail.outbox[0].body)
self.assertIn(u'contact Open edX support at '
u'<a href="mailto:{email}?Subject=Proctored exam Test Exam in edx demo for user tester"> '
u'{email} </a>'.format(email=expected_email),
self.assertIn(u'<a href="{contact_url}"> '
u'{contact_url} </a>'.format(contact_url=contact_url),
actual_body)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@edx/edx-proctoring",
"//": "Be sure to update the version number in edx_proctoring/__init__.py",
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.",
"version": "2.2.6",
"version": "2.2.7",
"main": "edx_proctoring/static/index.js",
"repository": {
"type": "git",
Expand Down

0 comments on commit 04f9d79

Please sign in to comment.