Skip to content

Commit

Permalink
Merge branch 'master' into rsgraber/send-new-signal
Browse files Browse the repository at this point in the history
  • Loading branch information
timmc-edx committed Aug 8, 2022
2 parents c9ce3b6 + b164b87 commit ec2d138
Show file tree
Hide file tree
Showing 83 changed files with 92,583 additions and 92,499 deletions.
5 changes: 5 additions & 0 deletions cms/static/js/i18n/es-419/djangojs.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
"(Caption will be displayed when you start playing the video.)": "(Los subt\u00edtulos ser\u00e1n mostrados al iniciar la reproducci\u00f3n del video.)",
"(Community TA)": "(Profesor ayudante de la comunidad)",
"(Optional)": "(Opcional)",
"(Read-only)": "(Solo-lectura)",
"(Required Field)": "(Campo requerido)",
"(Self-paced) Ended {end}": "(A ritmo propio) Terminado {end}",
"(Self-paced) Ends {end}": "(A ritmo propio)Termina{end}",
Expand Down Expand Up @@ -643,7 +644,9 @@
"Course Name": "T\u00edtulo del curso",
"Course Number": "C\u00f3digo del curso",
"Course Number Override": "Reemplazo para el n\u00famero de curso",
"Course Number:": "N\u00famero del curso:",
"Course Outline": "Estructura del curso",
"Course Run:": "Curso dirigido por:",
"Course Start": "Inicio del Curso",
"Course Title": "T\u00edtulo del curso",
"Course Title Override": "Reemplazo para el t\u00edtulo del curso",
Expand Down Expand Up @@ -1382,6 +1385,7 @@
"Organization ": "Organizaci\u00f3n",
"Organization Name": "Nombre de la organizaci\u00f3n",
"Organization of the signatory": "Organizaci\u00f3n del signatario",
"Organization:": "Organizaci\u00f3n:",
"Other": "Otros",
"Other sign-in issues": "Otros problemas para iniciar sesi\u00f3n",
"Overall Score": "Puntaje general",
Expand Down Expand Up @@ -1528,6 +1532,7 @@
"Questions raise issues that need answers. Discussions share ideas and start conversations. (Required)": "Utiliza Pregunta para plantear temas que necesitan respuestas. Utiliza Discusi\u00f3n para compartir tus ideas y comenzar conversaciones. (Requerido)",
"Queued": "En cola",
"REMAINING COURSES": "CURSOS RESTANTES",
"Re-run Course": "Reabrir Curso",
"Read More": "Leer mas",
"Read more": "Leer m\u00e1s",
"Ready To Start": "Listo para comenzar",
Expand Down
25 changes: 25 additions & 0 deletions common/djangoapps/student/tests/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from django.test.client import RequestFactory
from django.urls import reverse
from django.utils.html import escape
from testfixtures import LogCapture

from common.djangoapps.edxmako.shortcuts import marketing_link
from common.djangoapps.student.email_helpers import generate_proctoring_requirements_email_context
Expand Down Expand Up @@ -188,6 +189,30 @@ def test_do_not_send_email_and_do_activate(self):
assert user.is_active
assert email.called is False, 'method should not have been called'

@patch('common.djangoapps.student.views.management.send_activation_email.delay')
def test_activation_email_exception(self, mock_task):
"""
Test that if an exception occurs within send_activation_email, it is logged
and not raised.
"""
mock_task.side_effect = Exception('BOOM!')
inactive_user = UserFactory(is_active=False)
Registration().register(inactive_user)
request = RequestFactory().get(settings.SOCIAL_AUTH_INACTIVE_USER_URL)
request.user = inactive_user
with patch('common.djangoapps.edxmako.request_context.get_current_request', return_value=request):
with patch('common.djangoapps.third_party_auth.pipeline.running', return_value=False):
with LogCapture() as logger:
inactive_user_view(request)
assert mock_task.called is True, 'method should have been called'
logger.check_present(
(
'edx.student',
'ERROR',
f'Activation email task failed for user {inactive_user.id}.'
)
)

@patch('common.djangoapps.student.views.management.compose_activation_email')
def test_send_email_to_inactive_user(self, email):
"""
Expand Down
5 changes: 4 additions & 1 deletion common/djangoapps/student/views/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ def compose_and_send_activation_email(user, profile, user_registration=None, red
configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
)

send_activation_email.delay(str(msg), from_address)
try:
send_activation_email.delay(str(msg), from_address)
except Exception: # pylint: disable=broad-except
log.exception(f'Activation email task failed for user {user.id}.')


@login_required
Expand Down
Loading

0 comments on commit ec2d138

Please sign in to comment.