def testFormatMailgunBadKeys(self): data = { "bad": "*****@*****.**", "to_name": "Calvin", "from": "*****@*****.**", "from_name": "Calvin2", "body": "<h1>World!</h1>", "subject": "Hello" } self.failIf(email_sender.format_mailgun(data))
def testFormatMailgun(self): data = { "to": "*****@*****.**", "to_name": "Calvin", "from": "*****@*****.**", "from_name": "Calvin2", "body": "<h1>World!</h1>", "subject": "Hello" } response = email_sender.format_mailgun(data) self.assertEqual(response['to'], "Calvin <*****@*****.**>") self.assertEqual(response['from'], "Calvin2 <*****@*****.**>") self.assertEqual(response['text'], "World!") self.assertEqual(response['subject'], "Hello")