|
@ -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 => { |
|
|