Skip to content

Commit

Permalink
Added unit tests to cover my previous commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Andrzejewski committed Oct 19, 2012
1 parent 5557476 commit 8166dbe
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/with_dummyserver/test_https.py
@@ -1,4 +1,5 @@
import logging
import ssl
import sys
import unittest

Expand All @@ -21,9 +22,21 @@ def setUp(self):

def test_simple(self):
r = self._pool.request('GET', '/specific_method',
fields={'method': 'GET'})
fields={'method': 'GET'})
self.assertEqual(r.status, 200, r.data)

def test_set_ssl_version_to_tlsv1(self):
self._pool.ssl_version = ssl.PROTOCOL_TLSv1
r = self._pool.request('GET', '/specific_method',
fields={'method': 'GET'})
self.assertEqual(r.status, 200, r.data)

def test_set_ssl_version_to_sslv2(self):
self._pool.ssl_version = ssl.PROTOCOL_SSLv2
with self.assertRaises(SSLError):
r = self._pool.request('GET', '/specific_method',
fields={'method': 'GET'})

def test_verified(self):
https_pool = HTTPSConnectionPool(self.host, self.port,
cert_reqs='CERT_REQUIRED')
Expand Down

0 comments on commit 8166dbe

Please sign in to comment.