diff --git a/djrill/mail/backends/djrill.py b/djrill/mail/backends/djrill.py index 9114ca9..ddf1937 100644 --- a/djrill/mail/backends/djrill.py +++ b/djrill/mail/backends/djrill.py @@ -173,12 +173,12 @@ class DjrillBackend(BaseEmailBackend): def _expand_merge_vars(self, vars): - """Convert a Python dict to an array of name-value used by Mandrill. + """Convert a Python dict to an array of name-content used by Mandrill. - { name: value, ... } --> [ {'name': name, 'value': value }, ... ] + { name: value, ... } --> [ {'name': name, 'content': value }, ... ] """ # For testing reproducibility, we sort the keys - return [ { 'name': name, 'value': vars[name] } + return [ { 'name': name, 'content': vars[name] } for name in sorted(vars.keys()) ] def _add_alternatives(self, message, msg_dict): diff --git a/djrill/tests/test_mandrill_send.py b/djrill/tests/test_mandrill_send.py index ad89306..bd875da 100644 --- a/djrill/tests/test_mandrill_send.py +++ b/djrill/tests/test_mandrill_send.py @@ -249,7 +249,7 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase): self.assertEqual(data['message']['preserve_recipients'], True) def test_merge(self): - # Djrill expands simple python dicts into the more-verbose name/value + # Djrill expands simple python dicts into the more-verbose name/content # structures the Mandrill API uses self.message.global_merge_vars = { 'GREETING': "Hello", 'ACCOUNT_TYPE': "Basic" } @@ -261,14 +261,14 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase): self.message.send() data = self.get_api_call_data() self.assertEqual(data['message']['global_merge_vars'], - [ {'name': 'ACCOUNT_TYPE', 'value': "Basic"}, - {'name': "GREETING", 'value': "Hello"} ]) + [ {'name': 'ACCOUNT_TYPE', 'content': "Basic"}, + {'name': "GREETING", 'content': "Hello"} ]) self.assertEqual(data['message']['merge_vars'], [ { 'rcpt': "customer@example.com", - 'vars': [{ 'name': 'ACCOUNT_TYPE', 'value': "Premium" }, - { 'name': "GREETING", 'value': "Dear Customer"}] }, + 'vars': [{ 'name': 'ACCOUNT_TYPE', 'content': "Premium" }, + { 'name': "GREETING", 'content': "Dear Customer"}] }, { 'rcpt': "guest@example.com", - 'vars': [{ 'name': "GREETING", 'value': "Dear Guest"}] } + 'vars': [{ 'name': "GREETING", 'content': "Dear Guest"}] } ]) def test_tags(self): @@ -291,7 +291,7 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase): self.message.metadata = { 'batch_num': "12345", 'type': "Receipts" } self.message.recipient_metadata = { # Djrill expands simple python dicts into the more-verbose - # name/value structures the Mandrill API uses + # rcpt/values structures the Mandrill API uses "customer@example.com": { 'cust_id': "67890", 'order_id': "54321" }, "guest@example.com": { 'cust_id': "94107", 'order_id': "43215" } } diff --git a/djrill/tests/test_mandrill_send_template.py b/djrill/tests/test_mandrill_send_template.py index 4278907..51d0190 100644 --- a/djrill/tests/test_mandrill_send_template.py +++ b/djrill/tests/test_mandrill_send_template.py @@ -18,13 +18,13 @@ class DjrillMandrillSendTemplateTests(DjrillBackendMockAPITestCase): self.assert_mandrill_called("/messages/send-template.json") data = self.get_api_call_data() self.assertEqual(data['template_name'], "PERSONALIZED_SPECIALS") - # Djrill expands simple python dicts into the more-verbose name/value + # Djrill expands simple python dicts into the more-verbose name/content # structures the Mandrill API uses self.assertEqual(data['template_content'], [ {'name': "HEADLINE", - 'value': "
Half off all fruit
"} ] + 'content': "Half off all fruit
"} ] ) def test_no_template_content(self):