-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reply To header now supports friendly name
- Loading branch information
Showing
6 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
version_info = (1, 4, 2) | ||
version_info = (1, 4, 3) | ||
__version__ = '.'.join(str(v) for v in version_info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,10 @@ | |
from sendgrid.sendgrid import HTTPError | ||
|
||
SG_USER = os.getenv('SG_USER') or 'SENDGRID_USERNAME' | ||
SG_PWD = os.getenv('SG_PWD') or 'SENDGRID_PASSWORD' | ||
SG_PWD = os.getenv('SG_PWD') or 'SENDGRID_PASSWORD' | ||
|
||
|
||
class TestSendGrid(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.sg = SendGridClient(SG_USER, SG_PWD) | ||
|
||
|
@@ -57,6 +57,7 @@ def test_send(self): | |
m.add_unique_arg('testUnique', 'uniqueValue') | ||
m.add_filter('testFilter', 'filter', 'filterValue') | ||
m.add_attachment_stream('testFile', 'fileValue') | ||
m.set_replyto('John, Doe <[email protected]>') | ||
url = self.sg._build_body(m) | ||
url.pop('api_key', None) | ||
url.pop('api_user', None) | ||
|
@@ -72,8 +73,11 @@ def test_send(self): | |
"from": "[email protected]", | ||
"cc[]": ["[email protected]"], | ||
"bcc[]": ["[email protected]"] | ||
} | ||
''') | ||
test_url['headers'] = "{\"Reply-To\": \"John, Doe <[email protected]>\"}" | ||
|
||
test_url['x-smtpapi'] = json.dumps(json.loads(''' | ||
{ | ||
"sub": { | ||
|
@@ -120,7 +124,6 @@ def test__build_body_unicode(self): | |
self.assertEqual(text, url['text']) | ||
self.assertEqual(html, url['html']) | ||
|
||
|
||
def test_smtpapi_add_to(self): | ||
'''Test that message.to gets a dummy address for the header to work''' | ||
m = Mail() | ||
|
@@ -146,14 +149,14 @@ def test_smtpapi_add_to(self): | |
self.assertEqual(url, test_url) | ||
|
||
|
||
|
||
class SendGridClientUnderTest(SendGridClient): | ||
|
||
def _make_request(self, message): | ||
raise self.error | ||
|
||
|
||
class TestSendGridErrorHandling(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.sg = SendGridClientUnderTest(SG_USER, SG_PWD, raise_errors=True) | ||
|
||
|
iteritems
was removed in Python3. This breaks thesendgrid
library for all Python 3 users. This has been reported in GitHub Issue #126