mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Remove pre-Django 1.8 compatibility code
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
# this empty models.py is here for Django testrunner compatibility pre Django 1.6
|
|
||||||
15
runtests.py
15
runtests.py
@@ -3,7 +3,11 @@
|
|||||||
# python runtests.py [anymail.tests.test_x anymail.tests.test_y.SomeTestCase ...]
|
# python runtests.py [anymail.tests.test_x anymail.tests.test_y.SomeTestCase ...]
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from django import setup
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.test.runner import DiscoverRunner as TestRunner
|
||||||
|
|
||||||
|
|
||||||
APP = 'anymail'
|
APP = 'anymail'
|
||||||
|
|
||||||
@@ -37,17 +41,8 @@ settings.configure(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
# Initialize Django app registry
|
||||||
# Django 1.7+ initialize app registry
|
|
||||||
from django import setup
|
|
||||||
setup()
|
setup()
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
from django.test.runner import DiscoverRunner as TestRunner # Django 1.6+
|
|
||||||
except ImportError:
|
|
||||||
from django.test.simple import DjangoTestSuiteRunner as TestRunner # Django -1.5
|
|
||||||
|
|
||||||
|
|
||||||
def runtests(*args):
|
def runtests(*args):
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
# Exposing all TestCases at the 'tests' module level
|
|
||||||
# is required by the old (<=1.5) DjangoTestSuiteRunner.
|
|
||||||
|
|
||||||
from .test_mailgun_backend import *
|
|
||||||
from .test_mailgun_integration import *
|
|
||||||
|
|
||||||
from .test_mandrill_backend import *
|
|
||||||
from .test_mandrill_integration import *
|
|
||||||
|
|
||||||
from .test_postmark_backend import *
|
|
||||||
from .test_postmark_integration import *
|
|
||||||
|
|
||||||
from .test_sendgrid_backend import *
|
|
||||||
from .test_sendgrid_webhooks import *
|
|
||||||
from .test_sendgrid_integration import *
|
|
||||||
|
|
||||||
# Djrill leftovers:
|
|
||||||
from .test_mandrill_djrill_features import *
|
|
||||||
|
|||||||
@@ -111,15 +111,9 @@ class MailgunBackendStandardEmailTests(MailgunBackendMockAPITestCase):
|
|||||||
self.assertEqual(data['html'], html_content)
|
self.assertEqual(data['html'], html_content)
|
||||||
|
|
||||||
def test_reply_to(self):
|
def test_reply_to(self):
|
||||||
# reply_to is new in Django 1.8 -- before that, you can simply include it in headers
|
|
||||||
try:
|
|
||||||
# noinspection PyArgumentList
|
|
||||||
email = mail.EmailMessage('Subject', 'Body goes here', 'from@example.com', ['to1@example.com'],
|
email = mail.EmailMessage('Subject', 'Body goes here', 'from@example.com', ['to1@example.com'],
|
||||||
reply_to=['reply@example.com', 'Other <reply2@example.com>'],
|
reply_to=['reply@example.com', 'Other <reply2@example.com>'],
|
||||||
headers={'X-Other': 'Keep'})
|
headers={'X-Other': 'Keep'})
|
||||||
except TypeError:
|
|
||||||
# Pre-Django 1.8
|
|
||||||
return self.skipTest("Django version doesn't support EmailMessage(reply_to)")
|
|
||||||
email.send()
|
email.send()
|
||||||
data = self.get_api_call_data()
|
data = self.get_api_call_data()
|
||||||
self.assertEqual(data['h:Reply-To'], 'reply@example.com, Other <reply2@example.com>')
|
self.assertEqual(data['h:Reply-To'], 'reply@example.com, Other <reply2@example.com>')
|
||||||
|
|||||||
@@ -132,15 +132,9 @@ class MandrillBackendStandardEmailTests(MandrillBackendMockAPITestCase):
|
|||||||
self.assertEqual(data['message']['html'], html_content)
|
self.assertEqual(data['message']['html'], html_content)
|
||||||
|
|
||||||
def test_reply_to(self):
|
def test_reply_to(self):
|
||||||
# reply_to is new in Django 1.8 -- before that, you can simply include it in headers
|
|
||||||
try:
|
|
||||||
# noinspection PyArgumentList
|
|
||||||
email = mail.EmailMessage('Subject', 'Body goes here', 'from@example.com', ['to1@example.com'],
|
email = mail.EmailMessage('Subject', 'Body goes here', 'from@example.com', ['to1@example.com'],
|
||||||
reply_to=['reply@example.com', 'Other <reply2@example.com>'],
|
reply_to=['reply@example.com', 'Other <reply2@example.com>'],
|
||||||
headers={'X-Other': 'Keep'})
|
headers={'X-Other': 'Keep'})
|
||||||
except TypeError:
|
|
||||||
# Pre-Django 1.8
|
|
||||||
raise unittest.SkipTest("Django version doesn't support EmailMessage(reply_to)")
|
|
||||||
email.send()
|
email.send()
|
||||||
data = self.get_api_call_json()
|
data = self.get_api_call_json()
|
||||||
self.assertEqual(data['message']['headers']['Reply-To'],
|
self.assertEqual(data['message']['headers']['Reply-To'],
|
||||||
|
|||||||
@@ -130,15 +130,9 @@ class PostmarkBackendStandardEmailTests(PostmarkBackendMockAPITestCase):
|
|||||||
self.message.send()
|
self.message.send()
|
||||||
|
|
||||||
def test_reply_to(self):
|
def test_reply_to(self):
|
||||||
# reply_to is new in Django 1.8 -- before that, you can simply include it in headers
|
|
||||||
try:
|
|
||||||
# noinspection PyArgumentList
|
|
||||||
email = mail.EmailMessage('Subject', 'Body goes here', 'from@example.com', ['to1@example.com'],
|
email = mail.EmailMessage('Subject', 'Body goes here', 'from@example.com', ['to1@example.com'],
|
||||||
reply_to=['reply@example.com', 'Other <reply2@example.com>'],
|
reply_to=['reply@example.com', 'Other <reply2@example.com>'],
|
||||||
headers={'X-Other': 'Keep'})
|
headers={'X-Other': 'Keep'})
|
||||||
except TypeError:
|
|
||||||
# Pre-Django 1.8
|
|
||||||
return self.skipTest("Django version doesn't support EmailMessage(reply_to)")
|
|
||||||
email.send()
|
email.send()
|
||||||
data = self.get_api_call_json()
|
data = self.get_api_call_json()
|
||||||
self.assertEqual(data['ReplyTo'], 'reply@example.com, Other <reply2@example.com>')
|
self.assertEqual(data['ReplyTo'], 'reply@example.com, Other <reply2@example.com>')
|
||||||
|
|||||||
@@ -169,15 +169,9 @@ class SendGridBackendStandardEmailTests(SendGridBackendMockAPITestCase):
|
|||||||
self.message.send()
|
self.message.send()
|
||||||
|
|
||||||
def test_reply_to(self):
|
def test_reply_to(self):
|
||||||
# reply_to is new in Django 1.8 -- before that, you can simply include it in headers
|
|
||||||
try:
|
|
||||||
# noinspection PyArgumentList
|
|
||||||
email = mail.EmailMessage('Subject', 'Body goes here', 'from@example.com', ['to1@example.com'],
|
email = mail.EmailMessage('Subject', 'Body goes here', 'from@example.com', ['to1@example.com'],
|
||||||
reply_to=['reply@example.com', 'Other <reply2@example.com>'],
|
reply_to=['reply@example.com', 'Other <reply2@example.com>'],
|
||||||
headers={'X-Other': 'Keep'})
|
headers={'X-Other': 'Keep'})
|
||||||
except TypeError:
|
|
||||||
# Pre-Django 1.8
|
|
||||||
return self.skipTest("Django version doesn't support EmailMessage(reply_to)")
|
|
||||||
email.send()
|
email.send()
|
||||||
data = self.get_api_call_data()
|
data = self.get_api_call_data()
|
||||||
self.assertNotIn('replyto', data) # don't use SendGrid's replyto (it's broken); just use headers
|
self.assertNotIn('replyto', data) # don't use SendGrid's replyto (it's broken); just use headers
|
||||||
|
|||||||
Reference in New Issue
Block a user