-
Notifications
You must be signed in to change notification settings - Fork 64
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 #17 from campaignmonitor/better-ssl-cert-verification
Better SSL Certificate Verification
- Loading branch information
Showing
3 changed files
with
121 additions
and
21 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import unittest | ||
|
||
from createsend import * | ||
from createsend.utils import match_hostname | ||
|
||
class VerifiedHTTPSConnectionTestCase(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.cs = CreateSend({'api_key': 'not an api key'}) | ||
|
||
def test_verified_connection_no_cert(self): | ||
self.assertRaises(ValueError, match_hostname, None, 'api.createsend.com') | ||
|
||
def test_verified_connection(self): | ||
# An actual (non-stubbed) unauthenticated request to test verification. | ||
self.assertRaises(Unauthorized, self.cs.clients) |