def testGetViaHttpsKeyCert(self):
# At this point I can only test
# that the key and cert files are passed in
# correctly to httplib. It would be nice to have
# a real https endpoint to test against.
http = httplib2.Http(timeout=2)
http.add_certificate("akeyfile", "acertfile", "bitworking.org")
try:
(response, content) = http.request("https://bitworking.org", "GET")
except AttributeError:
self.assertEqual(http.connections["https:bitworking.org"].key_file, "akeyfile")
self.assertEqual(http.connections["https:bitworking.org"].cert_file, "acertfile")
except IOError:
# Skip on 3.2
pass
try:
(response, content) = http.request("https://notthere.bitworking.org", "GET")
except httplib2.ServerNotFoundError:
self.assertEqual(http.connections["https:notthere.bitworking.org"].key_file, None)
self.assertEqual(http.connections["https:notthere.bitworking.org"].cert_file, None)
except IOError:
# Skip on 3.2
pass
评论列表
文章目录