diff --git a/common/djangoapps/student/tests/test_email.py b/common/djangoapps/student/tests/test_email.py index 7e0137dd84..95f5af6881 100644 --- a/common/djangoapps/student/tests/test_email.py +++ b/common/djangoapps/student/tests/test_email.py @@ -292,7 +292,7 @@ class EmailChangeRequestTests(EventTestMixin, EmailTemplateTagMixin, CacheIsolat """ self.assertEqual(self.do_email_validation(self.user.email), 'Old email is the same as the new email.') - @patch('django.core.mail.send_mail') + @patch('django.core.mail.EmailMultiAlternatives.send') def test_email_failure(self, send_mail): """ Test the return value if sending the email for the user to click fails. @@ -590,7 +590,7 @@ class SecondaryEmailChangeRequestTests(EventTestMixin, EmailTemplateTagMixin, Ca for email in ('bad_email', 'bad_email@', '@bad_email'): self.assertEqual(self.do_email_validation(email), 'Valid e-mail address required.') - @patch('django.core.mail.send_mail') + @patch('django.core.mail.EmailMultiAlternatives.send') def test_email_failure(self, send_mail): """ Test the return value if sending the email for the user to click fails. diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_api.py b/openedx/core/djangoapps/user_api/accounts/tests/test_api.py index b9b48fbe3c..e1b8ee63bb 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_api.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_api.py @@ -367,7 +367,7 @@ class TestAccountApi(UserSettingsEventTestMixin, EmailTemplateTagMixin, CreateAc self.assertIn("Valid e-mail address required.", field_errors["email"]["developer_message"]) self.assertIn("Full Name cannot contain the following characters: < >", field_errors["name"]["user_message"]) - @patch('django.core.mail.send_mail') + @patch('django.core.mail.EmailMultiAlternatives.send') @patch('student.views.management.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True)) def test_update_sending_email_fails(self, send_mail): """Test what happens if all validation checks pass, but sending the email for email change fails.""" diff --git a/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py b/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py index a4b1ec1b24..cca7a87a06 100644 --- a/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py +++ b/openedx/core/djangoapps/user_authn/views/tests/test_reset_password.py @@ -191,10 +191,9 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): re.search(r'password_reset_confirm/(?P[0-9A-Za-z]+)-(?P.+)/', body).groupdict() @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS") - @patch('django.core.mail.send_mail') @ddt.data((False, 'http://'), (True, 'https://')) @ddt.unpack - def test_reset_password_email_https(self, is_secure, protocol, send_email): + def test_reset_password_email_https(self, is_secure, protocol): """ Tests that the right url protocol is included in the reset password link """ @@ -205,7 +204,8 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): req.is_secure = Mock(return_value=is_secure) req.user = self.user password_reset(req) - _, msg, _, _ = send_email.call_args[0] + sent_message = mail.outbox[0] + msg = sent_message.body expected_msg = "Please go to the following page and choose a new password:\n\n" + protocol self.assertIn(expected_msg, msg) @@ -215,10 +215,9 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): ) @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS") - @patch('django.core.mail.send_mail') @ddt.data(('Crazy Awesome Site', 'Crazy Awesome Site'), ('edX', 'edX')) @ddt.unpack - def test_reset_password_email_site(self, site_name, platform_name, send_email): + def test_reset_password_email_site(self, site_name, platform_name): """ Tests that the right url domain and platform name is included in the reset password email @@ -231,7 +230,8 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): req.user = self.user req.site = Mock(domain='example.com') password_reset(req) - _, msg, _, _ = send_email.call_args[0] + sent_message = mail.outbox[0] + msg = sent_message.body reset_msg = u"you requested a password reset for your user account at {}" reset_msg = reset_msg.format(site_name) @@ -468,9 +468,8 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): self.assertTrue(self.user.is_active) @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS") - @patch('django.core.mail.send_mail') @ddt.data('Crazy Awesome Site', 'edX') - def test_reset_password_email_subject(self, platform_name, send_email): + def test_reset_password_email_subject(self, platform_name): """ Tests that the right platform name is included in the reset password email subject @@ -482,7 +481,8 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): req.user = self.user req.site = Mock(domain='example.com') password_reset(req) - subj, _, _, _ = send_email.call_args[0] + sent_message = mail.outbox[0] + subj = sent_message.subject self.assertIn(platform_name, subj) diff --git a/requirements/edx/base.in b/requirements/edx/base.in index def05a9d29..46a5e7fb4a 100644 --- a/requirements/edx/base.in +++ b/requirements/edx/base.in @@ -67,7 +67,7 @@ django-webpack-loader # Used to wire webpack bundles into the djan djangorestframework==3.7.7 djangorestframework-jwt drf-yasg # Replacement for django-rest-swagger -edx-ace==0.1.10 +edx-ace edx-analytics-data-api-client edx-bulk-grades # LMS REST API for managing bulk grading operations edx-ccx-keys @@ -75,7 +75,7 @@ edx-celeryutils edx-completion edx-django-oauth2-provider edx-django-release-util # Release utils for the edx release pipeline -edx-django-sites-extensions==2.3.1 +edx-django-sites-extensions edx-django-utils edx-drf-extensions edx-enterprise diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index cf2b881f3b..f6e4809c44 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -25,7 +25,7 @@ aniso8601==8.0.0 # via tincan anyjson==0.3.3 # via kombu appdirs==1.4.3 # via fs argh==0.26.2 -attrs==17.4.0 +attrs==19.3.0 babel==1.3 backports.functools-lru-cache==1.6.1 # via soupsieve beautifulsoup4==4.8.1 # via pynliner @@ -94,7 +94,7 @@ djangorestframework==3.7.7 docopt==0.6.2 docutils==0.15.2 # via botocore drf-yasg==1.16 -edx-ace==0.1.10 +edx-ace==0.1.13 edx-analytics-data-api-client==0.15.3 edx-bulk-grades==0.6.6 edx-ccx-keys==1.0.0 @@ -102,7 +102,7 @@ edx-celeryutils==0.3.1 edx-completion==3.0.2 edx-django-oauth2-provider==1.3.5 edx-django-release-util==0.3.2 -edx-django-sites-extensions==2.3.1 +edx-django-sites-extensions==2.4.2 edx-django-utils==2.0.2 edx-drf-extensions==2.4.5 edx-enterprise==2.0.32 diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 05999b2e55..34636e0238 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -30,7 +30,7 @@ argh==0.26.2 argparse==1.4.0 astroid==1.5.3 atomicwrites==1.3.0 -attrs==17.4.0 +attrs==19.3.0 aws-xray-sdk==0.95 babel==1.3 backports.functools-lru-cache==1.6.1 @@ -116,7 +116,7 @@ docker==4.1.0 docopt==0.6.2 docutils==0.15.2 drf-yasg==1.16 -edx-ace==0.1.10 +edx-ace==0.1.13 edx-analytics-data-api-client==0.15.3 edx-bulk-grades==0.6.6 edx-ccx-keys==1.0.0 @@ -124,7 +124,7 @@ edx-celeryutils==0.3.1 edx-completion==3.0.2 edx-django-oauth2-provider==1.3.5 edx-django-release-util==0.3.2 -edx-django-sites-extensions==2.3.1 +edx-django-sites-extensions==2.4.2 edx-django-utils==2.0.2 edx-drf-extensions==2.4.5 edx-enterprise==2.0.32 diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 4cd73353f4..598c2f54f7 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -29,7 +29,7 @@ argh==0.26.2 argparse==1.4.0 # via caniusepython3 astroid==1.5.3 # via pylint, pylint-celery atomicwrites==1.3.0 # via pytest -attrs==17.4.0 +attrs==19.3.0 aws-xray-sdk==0.95 # via moto babel==1.3 backports.functools-lru-cache==1.6.1 @@ -113,7 +113,7 @@ docker==4.1.0 # via moto docopt==0.6.2 docutils==0.15.2 drf-yasg==1.16 -edx-ace==0.1.10 +edx-ace==0.1.13 edx-analytics-data-api-client==0.15.3 edx-bulk-grades==0.6.6 edx-ccx-keys==1.0.0 @@ -121,7 +121,7 @@ edx-celeryutils==0.3.1 edx-completion==3.0.2 edx-django-oauth2-provider==1.3.5 edx-django-release-util==0.3.2 -edx-django-sites-extensions==2.3.1 +edx-django-sites-extensions==2.4.2 edx-django-utils==2.0.2 edx-drf-extensions==2.4.5 edx-enterprise==2.0.32