Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP8 Fixes and String Formatting Enhancement #697

Merged
merged 2 commits into from
Oct 30, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions test/test_sendgrid.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sendgrid
from sendgrid.helpers.mail import *
from sendgrid.version import __version__

try:
import unittest2 as unittest
except ImportError:
Expand All @@ -25,7 +26,7 @@ def setUpClass(cls):
cls.sg = sendgrid.SendGridAPIClient(host=host)
cls.devnull = open(os.devnull, 'w')
prism_cmd = None

# try:
# # check for prism in the PATH
# if subprocess.call('prism version'.split(), stdout=cls.devnull) == 0:
Expand Down Expand Up @@ -134,7 +135,7 @@ def test_reset_request_headers(self):
self.assertNotIn('blah', self.sg.client.request_headers)
self.assertNotIn('blah2x', self.sg.client.request_headers)

for k,v in self.sg._default_headers.items():
for k, v in self.sg._default_headers.items():
self.assertEqual(v, self.sg.client.request_headers[k])

def test_hello_world(self):
Expand All @@ -144,11 +145,11 @@ def test_hello_world(self):
content = Content(
"text/plain", "and easy to do anywhere, even with Python")
mail = Mail(from_email, subject, to_email, content)
self.assertTrue(mail.get() == {
'content': [{'type': 'text/plain', 'value': 'and easy to do anywhere, even with Python'}],
'personalizations': [{'to': [{'email': '[email protected]'}]}], 'from': {'email': '[email protected]'},
'subject': 'Sending with SendGrid is Fun'
})
self.assertTrue(
mail.get() == {'content': [{'type': 'text/plain', 'value': 'and easy to do anywhere, even with Python'}],
'personalizations': [
{'to': [{'email': '[email protected]'}]}], 'from': {'email': '[email protected]'},
'subject': 'Sending with SendGrid is Fun'})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still seems like this should be changed from self.assertTrue to self.assertEqual? Maybe something like this?

self.assertEqual(mail.get(), {
    'content': [{
        'type': 'text/plain',
        'value': 'and easy to do anywhere, even with Python'
    }],
    'personalizations': [{
        'to': [{'email': '[email protected]'}]
    }],
    'from': {'email': '[email protected]'},
    'subject': 'Sending with SendGrid is Fun'
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@42B
You can create a new issue for this. I used the same code from master.


def test_access_settings_activity_get(self):
params = {'limit': 1}
Expand Down