node/test/parallel/test-tls-clientcertengine-unsupported.js
Mithun Sasidharan eae0c05697
test: replace assert.throws w/ common.expectsError
PR-URL: https://github.com/nodejs/node/pull/17498
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
2017-12-08 16:02:07 -05:00

28 lines
632 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
// Monkey-patch SecureContext
const binding = process.binding('crypto');
const NativeSecureContext = binding.SecureContext;
binding.SecureContext = function() {
const rv = new NativeSecureContext();
rv.setClientCertEngine = undefined;
return rv;
};
const tls = require('tls');
{
common.expectsError(
() => { tls.createSecureContext({ clientCertEngine: 'Cannonmouth' }); },
{
code: 'ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED',
message: 'Custom engines not supported by this OpenSSL'
}
);
}