Browse Source

Pify pem module

http2
Vsevolod Strukchinsky 9 years ago
parent
commit
501f71fa74
  1. 1
      package.json
  2. 24
      test/https.js

1
package.json

@ -63,6 +63,7 @@
"ava": "^0.2.0", "ava": "^0.2.0",
"into-stream": "^2.0.0", "into-stream": "^2.0.0",
"pem": "^1.4.4", "pem": "^1.4.4",
"pify": "^2.2.0",
"tempfile": "^1.1.1", "tempfile": "^1.1.1",
"xo": "*" "xo": "*"
}, },

24
test/https.js

@ -1,5 +1,6 @@
import test from 'ava'; import test from 'ava';
import pem from 'pem'; import pem from 'pem';
import pify from 'pify';
import got from '../'; import got from '../';
import {createSSLServer, portSSL} from './_server'; import {createSSLServer, portSSL} from './_server';
@ -9,20 +10,17 @@ let cert;
let caRootKey; let caRootKey;
let caRootCert; let caRootCert;
test.before('https - create root pem', t => { let pemify = pify.all(pem);
pem.createCertificate({
days: 1, test.before('https - create root pem', async t => {
selfSigned: true const keys = await pemify.createCertificate({days: 1, selfSigned: true});
}, (err, keys) => {
t.ifError(err);
caRootKey = keys.serviceKey; caRootKey = keys.serviceKey;
caRootCert = keys.certificate; caRootCert = keys.certificate;
t.end();
});
}); });
test.before('https - create pem', t => { test.before('https - create pem', async t => {
pem.createCertificate({ const keys = await pemify.createCertificate({
serviceCertificate: caRootCert, serviceCertificate: caRootCert,
serviceKey: caRootKey, serviceKey: caRootKey,
serial: Date.now(), serial: Date.now(),
@ -33,12 +31,10 @@ test.before('https - create pem', t => {
organization: '', organization: '',
organizationUnit: '', organizationUnit: '',
commonName: 'sindresorhus.com' commonName: 'sindresorhus.com'
}, (err, keys) => { });
t.ifError(err);
key = keys.clientKey; key = keys.clientKey;
cert = keys.certificate; cert = keys.certificate;
t.end();
});
}); });
test.before('https - setup', t => { test.before('https - setup', t => {

Loading…
Cancel
Save