'L{sslverify.simpleVerifyHostname} checks string equality on the
commonName of a connection\'s certificate\'s subject, doing nothing if it
matches and raising L{VerificationError} if it doesn\'t.'

def test_fallback(self):

    name = 'something.example.com'
    class Connection(object, ):
        def get_peer_certificate(self):
            '\n                                                                Fake    of    L{OpenSSL.SSL.Connection.get_peer_certificate}.\n\n                                                                @return:    A    certificate    with    a    known    common    name.\n                                                                @rtype:    L{OpenSSL.crypto.X509}\n                                                                '
            cert = X509()
            cert.get_subject().commonName = name
            return cert
    conn = Connection()
    self.assertIs(sslverify.simpleVerifyHostname(conn, u'something.example.com'), None)
    self.assertRaises(sslverify.SimpleVerificationError, sslverify.simpleVerifyHostname, conn, u'nonsense')
