def test_x509_in_verify_works(self):
    "\n        We had a bug where the X509 cert instantiated in the callback wrapper\n        didn't __init__ so it was missing objects needed when calling\n        get_subject. This test sets up a handshake where we call get_subject\n        on the cert provided to the verify callback.\n        "
    serverContext = Context(TLSv1_METHOD)
    serverContext.use_privatekey(load_privatekey(FILETYPE_PEM, cleartextPrivateKeyPEM))
    serverContext.use_certificate(load_certificate(FILETYPE_PEM, cleartextCertificatePEM))
    serverConnection = Connection(serverContext, None)

    def verify_cb_get_subject(conn, cert, errnum, depth, ok):
        assert cert.get_subject()
        return 1
    clientContext = Context(TLSv1_METHOD)
    clientContext.set_verify(VERIFY_PEER, verify_cb_get_subject)
    clientConnection = Connection(clientContext, None)
    clientConnection.set_connect_state()
    handshake_in_memory(clientConnection, serverConnection)
We had a bug where the X509 cert instantiated in the callback wrapper
didn't __init__ so it was missing objects needed when calling
get_subject. This test sets up a handshake where we call get_subject
on the cert provided to the verify callback.
def test_x509_in_verify_works(self):
    "\n        We had a bug where the X509 cert instantiated in the callback wrapper\n        didn't __init__ so it was missing objects needed when calling\n        get_subject. This test sets up a handshake where we call get_subject\n        on the cert provided to the verify callback.\n        "
    serverContext = Context(TLSv1_METHOD)
    serverContext.use_privatekey(load_privatekey(FILETYPE_PEM, cleartextPrivateKeyPEM))
    serverContext.use_certificate(load_certificate(FILETYPE_PEM, cleartextCertificatePEM))
    serverConnection = Connection(serverContext, None)

    def verify_cb_get_subject(conn, cert, errnum, depth, ok):
        assert cert.get_subject()
        return 1
    clientContext = Context(TLSv1_METHOD)
    clientContext.set_verify(VERIFY_PEER, verify_cb_get_subject)
    clientConnection = Connection(clientContext, None)
    clientConnection.set_connect_state()
    handshake_in_memory(clientConnection, serverConnection)