test_endpoints.py 文件源码

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

项目:zenchmarks 作者: squeaky-pl 项目源码 文件源码
def test_sslChainFileMustContainCert(self):
        """
        If C{extraCertChain} is passed, it has to contain at least one valid
        certificate in PEM format.
        """
        fp = FilePath(self.mktemp())
        fp.create().close()
        # The endpoint string is the same as in the valid case except for
        # a different chain file.  We use an empty temp file which obviously
        # will never contain any certificates.
        with self.assertRaises(ValueError) as caught:
            endpoints.serverFromString(
                object(),
                self.SSL_CHAIN_TEMPLATE % (
                    escapedPEMPathName,
                    endpoints.quoteStringArgument(fp.path),
                )
            )

        # The raised exception should list what file it is attempting to find
        # the chain in.
        self.assertEqual(str(caught.exception),
                         ("Specified chain file '%s' doesn't contain any valid"
                          " certificates in PEM format.") % (fp.path,))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号