Subaccounts: Document setting; verify message option overrides global setting

This commit is contained in:
medmunds
2014-04-20 12:57:08 -07:00
parent 7e928dcaba
commit ba2302ae56
4 changed files with 37 additions and 0 deletions

View File

@@ -12,3 +12,5 @@ peillis
José Padilla
Jens Alm
Eric Hennings
Michael Hobbs
Sameer Al-Sakran

View File

@@ -34,3 +34,14 @@ class DjrillMandrillSubaccountTests(DjrillBackendMockAPITestCase):
self.assertEqual(len(data['message']['to']), 1)
self.assertEqual(data['message']['to'][0]['email'], "to@example.com")
self.assertEqual(data['message']['subaccount'], settings.MANDRILL_SUBACCOUNT)
def test_subaccount_message_overrides_setting(self):
settings.MANDRILL_SUBACCOUNT = "global_setting_subaccount"
message = mail.EmailMessage(
'Subject here', 'Here is the message',
'from@example.com', ['to@example.com'])
message.subaccount = "individual_message_subaccount" # should override global setting
message.send()
self.assert_mandrill_called("/messages/send.json")
data = self.get_api_call_data()
self.assertEqual(data['message']['subaccount'], "individual_message_subaccount")

View File

@@ -15,6 +15,8 @@ library from Kenneth Reitz.
Configuration
-------------
.. setting:: MANDRILL_API_KEY
In your project's :file:`settings.py`:
1. Add :mod:`djrill` to your :setting:`INSTALLED_APPS`::
@@ -40,6 +42,26 @@ Djrill includes optional support for Mandrill webhooks, including inbound email.
See the Djrill :ref:`webhooks <webhooks>` section for configuration details.
Mandrill Subaccounts (Optional)
-------------------------------
.. setting:: MANDRILL_SUBACCOUNT
If you are using Mandrill's `subaccounts`_ feature, you can globally set the
subaccount for all messages sent through Djrill::
MANDRILL_SUBACCOUNT = "client-347"
(You can also set or override the :attr:`subaccount` on each individual message,
with :ref:`Mandrill-specific sending options <mandrill-send-support>`.)
.. versionadded:: 1.0
MANDRILL_SUBACCOUNT global setting
.. _subaccounts: http://help.mandrill.com/entries/25523278-What-are-subaccounts-
Admin (Optional)
----------------

View File

@@ -199,6 +199,8 @@ Most of the options from the Mandrill
.. attribute:: subaccount
``str``: the ID of one of your subaccounts to use for sending this message.
(The subaccount on an individual message will override any global
:setting:`MANDRILL_SUBACCOUNT` setting.)
.. versionadded:: 0.7