httplib2test.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:httplib2 作者: httplib2 项目源码 文件源码
def testSslCertValidation(self):
          # Test that we get an ssl.SSLError when specifying a non-existent CA
          # certs file.
          http = httplib2.Http(ca_certs='/nosuchfile')
          self.assertRaises(IOError,
                  http.request, "https://www.google.com/", "GET")

          # Test that we get a SSLHandshakeError if we try to access
          # https://www.google.com, using a CA cert file that doesn't contain
          # the CA Google uses (i.e., simulating a cert that's not signed by a
          # trusted CA).
          other_ca_certs = os.path.join(
                  os.path.dirname(os.path.abspath(httplib2.__file__ )),
                  "test", "other_cacerts.txt")
          http = httplib2.Http(ca_certs=other_ca_certs)
          self.assertRaises(ssl.SSLError,
            http.request,"https://www.google.com/", "GET")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号