mirror of https://github.com/nodejs/node.git
test: fix crypto-binary-default bad crypto check
This commit fixes a small bug introduced in 671fbd5
that caused the test to not be run. crypto was properly
checked, but since tls was not imported, a TypeError
would be thrown in the `try {} catch {}` block and
falsely reported as no crypto.
This is now fixed.
PR-URL: https://github.com/iojs/io.js/pull/1141
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
pull/1233/merge
parent
99c79f8d41
commit
999fbe9d96
|
@ -11,6 +11,7 @@ if (!common.hasCrypto) {
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
var crypto = require('crypto');
|
var crypto = require('crypto');
|
||||||
|
var tls = require('tls');
|
||||||
|
|
||||||
crypto.DEFAULT_ENCODING = 'binary';
|
crypto.DEFAULT_ENCODING = 'binary';
|
||||||
|
|
||||||
|
@ -27,18 +28,6 @@ var rsaPubPem = fs.readFileSync(common.fixturesDir + '/test_rsa_pubkey.pem',
|
||||||
var rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem',
|
var rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem',
|
||||||
'ascii');
|
'ascii');
|
||||||
|
|
||||||
// TODO(indutny): Move to a separate test eventually
|
|
||||||
try {
|
|
||||||
var context = tls.createSecureContext({
|
|
||||||
key: keyPem,
|
|
||||||
cert: certPem,
|
|
||||||
ca: caPem
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.log('Not compiled with OPENSSL support.');
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// PFX tests
|
// PFX tests
|
||||||
assert.doesNotThrow(function() {
|
assert.doesNotThrow(function() {
|
||||||
tls.createSecureContext({pfx:certPfx, passphrase:'sample'});
|
tls.createSecureContext({pfx:certPfx, passphrase:'sample'});
|
||||||
|
|
Loading…
Reference in New Issue