Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(certs-v5): add domain info in certs list and info #1660

Merged
merged 4 commits into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update tests
  • Loading branch information
cafreeman committed Oct 26, 2020
commit ed230bce4e59fe1dfb02dce5c92a0ee3b9403092
6 changes: 4 additions & 2 deletions packages/certs-v5/lib/display_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ function type (f) {

module.exports = function (certs) {
let mapped = certs.filter(function (f) { return f.ssl_cert }).map(function (f) {
return {
let tableContents = {
name: f.name,
cname: f.cname,
expires_at: f.ssl_cert.expires_at,
ca_signed: f.ssl_cert['ca_signed?'],
type: type(f),
common_names: f.ssl_cert.cert_domains.join(', '),
associated_domains: String(f.domains.length)
associated_domains: (f.domains && f.domains.length) ? f.domains.length : '0'
}

return tableContents
})

let columns = [
Expand Down
52 changes: 26 additions & 26 deletions packages/certs-v5/test/commands/certs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ describe('heroku certs', function () {
expect(cli.stderr).to.equal('')
/* eslint-disable no-trailing-spaces */
expect(cli.stdout).to.equal(
`Name Endpoint Common Name(s) Expires Trusted Type
────────── ──────────────────────── ────────────── ──────────────────── ─────── ────────
akita-7777 akita-7777.herokussl.com heroku.com 2013-08-01 21:34 UTC True Endpoint
tokyo-1050 tokyo-1050.herokussl.com example.org 2013-08-01 21:34 UTC False Endpoint
`Name Endpoint Common Name(s) Expires Trusted Type Domains
────────── ──────────────────────── ────────────── ──────────────────── ─────── ──────── ───────
akita-7777 akita-7777.herokussl.com heroku.com 2013-08-01 21:34 UTC True Endpoint 0
tokyo-1050 tokyo-1050.herokussl.com example.org 2013-08-01 21:34 UTC False Endpoint 0
`)
/* eslint-enable no-trailing-spaces */
})
Expand Down Expand Up @@ -82,10 +82,10 @@ tokyo-1050 tokyo-1050.herokussl.com example.org 2013-08-01 21:34 UTC Fals
expect(cli.stderr).to.equal('')
/* eslint-disable no-trailing-spaces */
expect(cli.stdout).to.equal(
`Name Endpoint Common Name(s) Expires Trusted Type
────────── ──────────────────────── ───────────────────────────────────────────────── ──────────────────── ─────── ────────
akita-7777 akita-7777.herokussl.com heroku.com 2013-08-01 21:34 UTC True Endpoint
tokyo-1050 (Not applicable for SNI) foo.example.org, bar.example.org, biz.example.com 2013-08-01 21:34 UTC False SNI
`Name Endpoint Common Name(s) Expires Trusted Type Domains
────────── ──────────────────────── ───────────────────────────────────────────────── ──────────────────── ─────── ──────── ───────
akita-7777 akita-7777.herokussl.com heroku.com 2013-08-01 21:34 UTC True Endpoint 0
tokyo-1050 (Not applicable for SNI) foo.example.org, bar.example.org, biz.example.com 2013-08-01 21:34 UTC False SNI 0
`)
/* eslint-enable no-trailing-spaces */
})
Expand All @@ -111,9 +111,9 @@ tokyo-1050 (Not applicable for SNI) foo.example.org, bar.example.org, biz.exam
expect(cli.stderr).to.equal('')
/* eslint-disable no-trailing-spaces */
expect(cli.stdout).to.equal(
`Name Endpoint Common Name(s) Expires Trusted Type
────────── ───────────────────────────────────── ────────────── ──────────────────── ─────── ─────────────────
tokyo-1050 tokyo-1050.japan-4321.herokuspace.com heroku.com 2013-08-01 21:34 UTC True Private Space App
`Name Endpoint Common Name(s) Expires Trusted Type Domains
────────── ───────────────────────────────────── ────────────── ──────────────────── ─────── ───────────────── ───────
tokyo-1050 tokyo-1050.japan-4321.herokuspace.com heroku.com 2013-08-01 21:34 UTC True Private Space App 0
`)
/* eslint-enable no-trailing-spaces */
})
Expand All @@ -138,9 +138,9 @@ tokyo-1050 tokyo-1050.japan-4321.herokuspace.com heroku.com 2013-08-01 21
expect(cli.stderr).to.equal('')
/* eslint-disable no-trailing-spaces */
expect(cli.stdout).to.equal(
`Name Common Name(s) Expires Trusted Type
────────── ────────────── ──────────────────── ─────── ────
tokyo-1050 heroku.com 2013-08-01 21:34 UTC True ACM
`Name Common Name(s) Expires Trusted Type Domains
────────── ────────────── ──────────────────── ─────── ──── ───────
tokyo-1050 heroku.com 2013-08-01 21:34 UTC True ACM 0
`)
/* eslint-enable no-trailing-spaces */
})
Expand All @@ -165,9 +165,9 @@ tokyo-1050 heroku.com 2013-08-01 21:34 UTC True ACM
expect(cli.stderr).to.equal('')
/* eslint-disable no-trailing-spaces */
expect(cli.stdout).to.equal(
`Name Common Name(s) Expires Trusted Type
────────── ───────────────────────────────────────────────── ──────────────────── ─────── ────
tokyo-1050 foo.example.org, bar.example.org, biz.example.com 2013-08-01 21:34 UTC False SNI
`Name Common Name(s) Expires Trusted Type Domains
────────── ───────────────────────────────────────────────── ──────────────────── ─────── ──── ───────
tokyo-1050 foo.example.org, bar.example.org, biz.example.com 2013-08-01 21:34 UTC False SNI 0
`)
/* eslint-enable no-trailing-spaces */
})
Expand All @@ -192,9 +192,9 @@ tokyo-1050 foo.example.org, bar.example.org, biz.example.com 2013-08-01 21:34
expect(cli.stderr).to.equal('')
/* eslint-disable no-trailing-spaces */
expect(cli.stdout).to.equal(
`Name Common Name(s) Expires Trusted Type
────────── ────────────── ──────────────────── ─────── ────
tokyo-1050 fooexample.org 2013-08-01 21:34 UTC False SNI
`Name Common Name(s) Expires Trusted Type Domains
────────── ────────────── ──────────────────── ─────── ──── ───────
tokyo-1050 fooexample.org 2013-08-01 21:34 UTC False SNI 0
`)
/* eslint-enable no-trailing-spaces */
})
Expand All @@ -219,9 +219,9 @@ tokyo-1050 fooexample.org 2013-08-01 21:34 UTC False SNI
expect(cli.stderr).to.equal('')
/* eslint-disable no-trailing-spaces */
expect(cli.stdout).to.equal(
`Name Common Name(s) Expires Trusted Type
────────── ────────────── ──────────────────── ─────── ────
tokyo-1050 *.example.org 2013-08-01 21:34 UTC False SNI
`Name Common Name(s) Expires Trusted Type Domains
────────── ────────────── ──────────────────── ─────── ──── ───────
tokyo-1050 *.example.org 2013-08-01 21:34 UTC False SNI 0
`)
/* eslint-enable no-trailing-spaces */
})
Expand All @@ -246,9 +246,9 @@ tokyo-1050 *.example.org 2013-08-01 21:34 UTC False SNI
expect(cli.stderr).to.equal('')
/* eslint-disable no-trailing-spaces */
expect(cli.stdout).to.equal(
`Name Common Name(s) Expires Trusted Type
────────── ───────────────────────────────────────────────── ──────────────────── ─────── ────
tokyo-1050 foo.example.org, bar.example.org, biz.example.com 2013-08-01 21:34 UTC False SNI
`Name Common Name(s) Expires Trusted Type Domains
────────── ───────────────────────────────────────────────── ──────────────────── ─────── ──── ───────
tokyo-1050 foo.example.org, bar.example.org, biz.example.com 2013-08-01 21:34 UTC False SNI 0
`)
/* eslint-enable no-trailing-spaces */
})
Expand Down