Commit 8816b854 by Omar Al-Ithawi Committed by Renzo Lucioni

Use the marketing contact us page in email confirm change message

parent 071f35ba
...@@ -9,7 +9,7 @@ from django.core import mail ...@@ -9,7 +9,7 @@ from django.core import mail
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db import transaction from django.db import transaction
from django.http import HttpResponse 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 django.test.client import RequestFactory
from mock import Mock, patch from mock import Mock, patch
...@@ -437,6 +437,25 @@ class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase): ...@@ -437,6 +437,25 @@ class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase):
) )
self.assertEquals(0, PendingEmailChange.objects.count()) 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)) @patch('student.views.PendingEmailChange.objects.get', Mock(side_effect=TestException))
def test_always_rollback(self, _email_user): def test_always_rollback(self, _email_user):
connection = transaction.get_connection() connection = transaction.get_connection()
......
<%! from django.core.urlresolvers import reverse %> <%! 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 This is to confirm that you changed the e-mail associated with
Open edX from ${old_email} to ${new_email}. If you Open edX from ${old_email} to ${new_email}. If you
did not make this request, please contact us immediately. Contact did not make this request, please contact us immediately. Contact
information is listed at: information is listed at:
% if is_secure: % if settings.FEATURES['ENABLE_MKTG_SITE']:
https://${ site }${reverse('contact')} ${marketing_link('CONTACT')}
% else: % else:
http://${ site }${reverse('contact')} http://${ site }${reverse('contact')}
% endif % endif
We keep a log of old e-mails, so if this request was unintentional, we We keep a log of old e-mails, so if this request was unintentional, we
......
<%! from django.core.urlresolvers import reverse %> <%! from django.core.urlresolvers import reverse %>
<%! from django.utils.translation import ugettext as _ %> <%! from django.utils.translation import ugettext as _ %>
<%! from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers %> <%! from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers %>
<%! from edxmako.shortcuts import render_to_string, marketing_link %>
${_("This is to confirm that you changed the e-mail associated with " ${_("This is to confirm that you changed the e-mail associated with "
"{platform_name} from {old_email} to {new_email}. If you " "{platform_name} from {old_email} to {new_email}. If you "
"did not make this request, please contact us immediately. Contact " "did not make this request, please contact us immediately. Contact "
...@@ -11,10 +12,14 @@ ${_("This is to confirm that you changed the e-mail associated with " ...@@ -11,10 +12,14 @@ ${_("This is to confirm that you changed the e-mail associated with "
) )
} }
% if is_secure: % if settings.FEATURES['ENABLE_MKTG_SITE']:
https://${ site }${reverse('contact')} ${marketing_link('CONTACT')}
% else: % else:
http://${ site }${reverse('contact')} % if is_secure:
https://${ site }${reverse('contact')}
% else:
http://${ site }${reverse('contact')}
% endif
% endif % endif
${_("We keep a log of old e-mails, so if this request was unintentional, we can investigate.")} ${_("We keep a log of old e-mails, so if this request was unintentional, we can investigate.")}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment