mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Drop support for the WEBHOOK_AUTHORIZATION setting deprecated in v1.4. Only the WEBHOOK_SECRET replacement is allowed now. Most Django management commands will now issue a system check error if the old name is still used in settings.py
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
from django.core import checks
|
|
from django.test import SimpleTestCase
|
|
from django.test.utils import override_settings
|
|
|
|
from anymail.checks import check_deprecated_settings
|
|
|
|
from .utils import AnymailTestMixin
|
|
|
|
|
|
class DeprecatedSettingsTests(SimpleTestCase, AnymailTestMixin):
|
|
@override_settings(ANYMAIL={"WEBHOOK_AUTHORIZATION": "abcde:12345"})
|
|
def test_webhook_authorization(self):
|
|
errors = check_deprecated_settings(None)
|
|
self.assertEqual(errors, [checks.Error(
|
|
"The ANYMAIL setting 'WEBHOOK_AUTHORIZATION' has been renamed 'WEBHOOK_SECRET' to improve security.",
|
|
hint="You must update your settings.py.",
|
|
id="anymail.E001",
|
|
)])
|
|
|
|
@override_settings(ANYMAIL_WEBHOOK_AUTHORIZATION="abcde:12345", ANYMAIL={})
|
|
def test_anymail_webhook_authorization(self):
|
|
errors = check_deprecated_settings(None)
|
|
self.assertEqual(errors, [checks.Error(
|
|
"The ANYMAIL_WEBHOOK_AUTHORIZATION setting has been renamed ANYMAIL_WEBHOOK_SECRET to improve security.",
|
|
hint="You must update your settings.py.",
|
|
id="anymail.E001",
|
|
)])
|