-
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.
Merge pull request #557 from 3lnc/client_cleanup
Client cleanup
- Loading branch information
Showing
3 changed files
with
55 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,7 @@ def setUpClass(cls): | |
cls.path = '{0}{1}'.format( | ||
os.path.abspath( | ||
os.path.dirname(__file__)), '/..') | ||
cls.sg = sendgrid.SendGridAPIClient( | ||
host=host, path=cls.path, | ||
api_key=os.environ.get('SENDGRID_API_KEY')) | ||
cls.sg = sendgrid.SendGridAPIClient(host=host) | ||
cls.devnull = open(os.devnull, 'w') | ||
prism_cmd = None | ||
|
||
|
@@ -98,8 +96,7 @@ def test_api_key_setter(self): | |
def test_impersonate_subuser_init(self): | ||
temp_subuser = '[email protected]' | ||
sg_impersonate = sendgrid.SendGridAPIClient( | ||
host=host, path=self.path, | ||
api_key=os.environ.get('SENDGRID_API_KEY'), | ||
host=host, | ||
impersonate_subuser=temp_subuser) | ||
self.assertEqual(sg_impersonate.impersonate_subuser, temp_subuser) | ||
|
||
|
@@ -111,14 +108,14 @@ def test_host(self): | |
self.assertEqual(self.sg.host, self.host) | ||
|
||
def test_get_default_headers(self): | ||
headers = self.sg._get_default_headers() | ||
headers = self.sg._default_headers | ||
self.assertIn('Authorization', headers) | ||
self.assertIn('User-agent', headers) | ||
self.assertIn('Accept', headers) | ||
self.assertNotIn('On-Behalf-Of', headers) | ||
|
||
self.sg._impersonate_subuser = '[email protected]' | ||
headers = self.sg._get_default_headers() | ||
self.sg.impersonate_subuser = '[email protected]' | ||
headers = self.sg._default_headers | ||
self.assertIn('Authorization', headers) | ||
self.assertIn('User-agent', headers) | ||
self.assertIn('Accept', headers) | ||
|
@@ -137,7 +134,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._get_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): | ||
|