SendGrid: update to new v3 send API (#50)

SendGrid: update to v3 send API

**SendGrid:** **[possibly-breaking]** Update SendGrid backend to newer Web API v3. This should be a transparent change for most projects. Exceptions: if you use SendGrid username/password auth, esp_extra with "x-smtpapi", or multiple Reply-To addresses, please review the [porting notes](http://anymail.readthedocs.io/en/latest/esps/sendgrid/#sendgrid-v3-upgrade).

Closes #28
This commit is contained in:
Mike Edmunds
2017-01-19 14:29:15 -08:00
committed by GitHub
parent ac8147b0b8
commit e568e50d0c
11 changed files with 1891 additions and 565 deletions

View File

@@ -81,12 +81,12 @@ class BackendSettingsTests(SimpleTestCase, AnymailTestMixin): # (so not
def test_username_password_kwargs_overrides(self):
"""Overrides for 'username' and 'password' should work like other overrides"""
# These are special-cased because of default args in Django core mail functions.
# (Use the SendGrid backend, which has settings named 'username' and 'password'.)
backend = get_connection('anymail.backends.sendgrid.SendGridBackend')
# (Use the SendGrid v2 backend, which has settings named 'username' and 'password'.)
backend = get_connection('anymail.backends.sendgrid_v2.EmailBackend')
self.assertEqual(backend.username, 'username_from_settings')
self.assertEqual(backend.password, 'password_from_settings')
backend = get_connection('anymail.backends.sendgrid.SendGridBackend',
backend = get_connection('anymail.backends.sendgrid_v2.EmailBackend',
username='username_from_kwargs', password='password_from_kwargs')
self.assertEqual(backend.username, 'username_from_kwargs')
self.assertEqual(backend.password, 'password_from_kwargs')