heroku-certs
Advanced tools
Comparing version 1.1.15 to 1.1.16
@@ -16,2 +16,7 @@ 'use strict' | ||
headers: {'Accept': 'application/vnd.heroku+json; version=3.sni_ssl_cert'} | ||
}).catch(function (err) { | ||
if (err.statusCode === 422 && err.body && err.body.id === 'space_app_not_supported') { | ||
return [] | ||
} | ||
throw err | ||
}).then(function (data) { | ||
@@ -18,0 +23,0 @@ return data |
{ | ||
"name": "heroku-certs", | ||
"version": "1.1.15", | ||
"version": "1.1.16", | ||
"description": "heroku ssl plugin", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -245,2 +245,38 @@ 'use strict' | ||
}) | ||
it('# traps the "id":"space_app_not_supported" error in dogwood', function () { | ||
nock('https://api.heroku.com') | ||
.get('/apps/example') | ||
.reply(200, { | ||
'space': {'name': 'spacely-space-1234'} | ||
}) | ||
nock('https://api.heroku.com') | ||
.get('/apps/example/addons/ssl%3Aendpoint') | ||
.reply(404, { | ||
'id': 'not_found', | ||
'resource': 'addon' | ||
}) | ||
nock('https://api.heroku.com') | ||
.get('/apps/example/domains') | ||
.reply(200, []) | ||
nock('https://api.heroku.com') | ||
.get('/apps/example/ssl-endpoints') | ||
.reply(200, []) | ||
let mock = nock('https://api.heroku.com') | ||
.get('/apps/example/sni-endpoints') | ||
.reply(422, { | ||
'id': 'space_app_not_supported', | ||
'message': 'App heroku-certs-test is in a space, but space apps are not supported on this endpoint. Try `/apps/:id/ssl-endpoints` instead.' | ||
}) | ||
return certs.run({app: 'example', args: {}, flags: {}}).then(function () { | ||
mock.done() | ||
expect(cli.stderr).to.equal('') | ||
expect(cli.stdout).to.equal(`example has no SSL certificates.\nUse heroku certs:add CRT KEY to add one.\n`) | ||
}) | ||
}) | ||
}) |
@@ -208,1 +208,55 @@ 'use strict' | ||
}) | ||
describe('heroku certs:update (dogwood)', function () { | ||
beforeEach(function () { | ||
cli.mockConsole() | ||
sinon.stub(fs, 'readFile') | ||
nock.cleanAll() | ||
}) | ||
afterEach(function () { | ||
fs.readFile.restore() | ||
}) | ||
it('# updates an endpoint when sni-endpoints 422s', function () { | ||
nock('https://api.heroku.com') | ||
.get('/apps/example') | ||
.reply(200, { | ||
'space': {'name': 'spacely-space-1234'} | ||
}) | ||
let mockSni = nock('https://api.heroku.com') | ||
.get('/apps/example/sni-endpoints') | ||
.reply(422, { | ||
'id': 'space_app_not_supported', | ||
'message': 'App heroku-certs-test is in a space, but space apps are not supported on this endpoint. Try `/apps/:id/ssl-endpoints` instead.' | ||
}) | ||
nock('https://api.heroku.com') | ||
.get('/apps/example/ssl-endpoints') | ||
.reply(200, [endpointStable]) | ||
fs.readFile | ||
.withArgs('pem_file', sinon.match.func) | ||
.callsArgWithAsync(1, null, 'pem content') | ||
fs.readFile | ||
.withArgs('key_file', sinon.match.func) | ||
.callsArgWithAsync(1, null, 'key content') | ||
let mockPut = nock('https://api.heroku.com') | ||
.patch('/apps/example/ssl-endpoints/tokyo-1050', { | ||
certificate_chain: 'pem content', private_key: 'key content' | ||
}) | ||
.reply(200, endpointStable) | ||
return certs.run({app: 'example', args: {CRT: 'pem_file', KEY: 'key_file'}, flags: {name: 'tokyo-1050', confirm: 'example', bypass: true}}).then(function () { | ||
mockSni.done() | ||
mockPut.done() | ||
expect(cli.stderr).to.equal('Updating SSL certificate tokyo-1050 for example... done\n') | ||
expect(cli.stdout).to.equal( | ||
`Updated certificate details: | ||
${certificateDetails} | ||
`) | ||
}) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134824
3216