':py:meth:`X509Req.sign` succeeds when passed a private key object and a valid
digest function.  :py:meth:`X509Req.verify` can be used to check the signature.'

def test_sign(self):

    request = self.signable()
    key = PKey()
    key.generate_key(TYPE_RSA, 512)
    request.set_pubkey(key)
    request.sign(key, GOOD_DIGEST)
    if (getattr(request, 'verify', None) is not None):
        pub = request.get_pubkey()
        self.assertTrue(request.verify(pub))
        key = PKey()
        key.generate_key(TYPE_RSA, 512)
        self.assertRaises(Error, request.verify, key)
