diff --git a/lib/commands/token.js b/lib/commands/token.js index 9cc04f83e7dd2..46267d5b2ef6c 100644 --- a/lib/commands/token.js +++ b/lib/commands/token.js @@ -95,9 +95,8 @@ class Token extends BaseCommand { this.generateTokenIds(tokens, 6) const chalk = this.npm.chalk for (const token of tokens) { - const level = token.readonly ? 'Read only token' : 'Publish token' const created = String(token.created).slice(0, 10) - output.standard(`${chalk.blue(level)} ${token.token}… with id ${chalk.cyan(token.id)} created ${created}`) + output.standard(`${chalk.blue('Token')} ${token.token}… with id ${chalk.cyan(token.id)} created ${created}`) if (token.cidr_whitelist) { output.standard(`with IP whitelist: ${chalk.green(token.cidr_whitelist.join(','))}`) } @@ -231,10 +230,7 @@ class Token extends BaseCommand { Object.keys(result).forEach(k => output.standard(k + '\t' + result[k])) } else { const chalk = this.npm.chalk - // Display based on access level - // Identical to list? XXX - const level = result.access === 'read-only' || result.readonly ? 'read only' : 'publish' - output.standard(`Created ${chalk.blue(level)} token ${result.token}`, { [META]: true, redact: false }) + output.standard(`Created token ${result.token}`, { [META]: true, redact: false }) if (result.cidr_whitelist?.length) { output.standard(`with IP whitelist: ${chalk.green(result.cidr_whitelist.join(','))}`) } diff --git a/test/lib/commands/token.js b/test/lib/commands/token.js index 76ffc4f7da80e..56ab906d921be 100644 --- a/test/lib/commands/token.js +++ b/test/lib/commands/token.js @@ -63,9 +63,9 @@ t.test('token list', async t => { registry.getTokens(tokens) await npm.exec('token', []) t.strictSame(outputs, [ - `Publish token efgh5678efgh5678… with id abcd123 created ${now.slice(0, 10)}`, + `Token efgh5678efgh5678… with id abcd123 created ${now.slice(0, 10)}`, '', - `Read only token hgfe8765… with id abcd125 created ${now.slice(0, 10)}`, + `Token hgfe8765… with id abcd125 created ${now.slice(0, 10)}`, 'with IP whitelist: 192.168.1.1/32', '', ]) @@ -263,7 +263,7 @@ t.test('token create defaults', async t => { }) await npm.exec('token', ['create']) - t.match(outputs, ['Created publish token n3wt0k3n']) + t.match(outputs, ['Created token n3wt0k3n']) }) t.test('token create extra token attributes', async t => { @@ -311,7 +311,7 @@ t.test('token create extra token attributes', async t => { await npm.exec('token', ['create']) t.match(outputs, [ - 'Created read only token n3wt0k3n', + 'Created token n3wt0k3n', 'with IP whitelist: 10.0.0.0/8,192.168.1.0/24', `expires: ${expires.toISOString()}`, ]) @@ -340,7 +340,7 @@ t.test('token create access.read-only', async t => { }) await npm.exec('token', ['create']) - t.match(outputs, ['Created read only token n3wt0k3n']) + t.match(outputs, ['Created token n3wt0k3n']) }) t.test('token create readonly', async t => { @@ -368,7 +368,7 @@ t.test('token create readonly', async t => { }) await npm.exec('token', ['create']) - t.match(outputs, ['Created read only token n3wt0k3n']) + t.match(outputs, ['Created token n3wt0k3n']) }) t.test('token create json output', async t => {