Use the marketing contact us page in email confirm change message
This commit is contained in:
committed by
Renzo Lucioni
parent
071f35ba12
commit
8816b85464
@@ -9,7 +9,7 @@ from django.core import mail
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db import transaction
|
||||
from django.http import HttpResponse
|
||||
from django.test import TestCase, TransactionTestCase
|
||||
from django.test import override_settings, TestCase, TransactionTestCase
|
||||
from django.test.client import RequestFactory
|
||||
from mock import Mock, patch
|
||||
|
||||
@@ -437,6 +437,25 @@ class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase):
|
||||
)
|
||||
self.assertEquals(0, PendingEmailChange.objects.count())
|
||||
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS")
|
||||
@override_settings(MKTG_URLS={'ROOT': 'https://dummy-root', 'CONTACT': '/help/contact-us'})
|
||||
def test_marketing_contact_link(self, _email_user):
|
||||
context = {
|
||||
'site': 'edx.org',
|
||||
'old_email': 'old@example.com',
|
||||
'new_email': 'new@example.com',
|
||||
}
|
||||
|
||||
confirm_email_body = render_to_string('emails/confirm_email_change.txt', context)
|
||||
# With marketing site disabled, should link to the LMS contact static page.
|
||||
# The http(s) part was omitted keep the test focused.
|
||||
self.assertIn('://edx.org/contact', confirm_email_body)
|
||||
|
||||
with patch.dict(settings.FEATURES, {'ENABLE_MKTG_SITE': True}):
|
||||
# Marketing site enabled, should link to the marketing site contact page.
|
||||
confirm_email_body = render_to_string('emails/confirm_email_change.txt', context)
|
||||
self.assertIn('https://dummy-root/help/contact-us', confirm_email_body)
|
||||
|
||||
@patch('student.views.PendingEmailChange.objects.get', Mock(side_effect=TestException))
|
||||
def test_always_rollback(self, _email_user):
|
||||
connection = transaction.get_connection()
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<%! from django.core.urlresolvers import reverse %>
|
||||
<%! from django.conf import settings %>
|
||||
<%! from edxmako.shortcuts import render_to_string, marketing_link %>
|
||||
|
||||
This is to confirm that you changed the e-mail associated with
|
||||
Open edX from ${old_email} to ${new_email}. If you
|
||||
did not make this request, please contact us immediately. Contact
|
||||
information is listed at:
|
||||
|
||||
% if is_secure:
|
||||
https://${ site }${reverse('contact')}
|
||||
% if settings.FEATURES['ENABLE_MKTG_SITE']:
|
||||
${marketing_link('CONTACT')}
|
||||
% else:
|
||||
http://${ site }${reverse('contact')}
|
||||
http://${ site }${reverse('contact')}
|
||||
% endif
|
||||
|
||||
We keep a log of old e-mails, so if this request was unintentional, we
|
||||
|
||||
Reference in New Issue
Block a user