From ed9465d927dfbf1ac718a339be78408b1a16d4e8 Mon Sep 17 00:00:00 2001 From: Diego Camargo Date: Tue, 29 Aug 2017 19:46:26 -0500 Subject: [PATCH] Allow the __str__ method for the Mail object return an String instead of a NoneType --- sendgrid/helpers/mail/mail.py | 2 +- test/test_mail.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sendgrid/helpers/mail/mail.py b/sendgrid/helpers/mail/mail.py index 59d218b8d..fa73f6570 100644 --- a/sendgrid/helpers/mail/mail.py +++ b/sendgrid/helpers/mail/mail.py @@ -33,7 +33,7 @@ def __init__( self.add_content(content) def __str__(self): - self.get() + return str(self.get()) def get(self): """ diff --git a/test/test_mail.py b/test/test_mail.py index 0b0a781ea..058f07a5b 100644 --- a/test/test_mail.py +++ b/test/test_mail.py @@ -65,6 +65,8 @@ def test_helloEmail(self): '"subject": "Hello World from the SendGrid Python Library"}' ) + self.assertTrue(isinstance(str(mail), str)) + def test_kitchenSink(self): self.maxDiff = None