'Raise L{EnvironmentError} if key creation fails.'

def test_keyFails(self):

    lib = FakeLib()
    lib.EC_KEY_new_by_curve_name = (lambda *a, **kw: FakeFFI.NULL)
    self.patch(sslverify._OpenSSLECCurve, '_getBinding', (lambda self: FakeBinding(lib=lib)))
    curve = sslverify._OpenSSLECCurve(sslverify._defaultCurveName)
    self.assertRaises(EnvironmentError, curve.addECKeyToContext, object())
