-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(auth): update warning message for auth:token (#2750)
* Update warning based on userpass * Add & update tests * Update copy
- Loading branch information
1 parent
2a72431
commit 4ddead4
Showing
2 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ describe('auth:token', () => { | |
.get('/oauth/authorizations') | ||
.reply(200, [ | ||
{access_token: {token: 'somethingelse'}}, | ||
{access_token: {token: 'foobar', expires_in: 60}}, | ||
{access_token: {token: 'foobar', expires_in: 60}, user: {email: '[email protected]'}}, | ||
{}, | ||
]), | ||
) | ||
|
@@ -18,4 +18,42 @@ describe('auth:token', () => { | |
expect(ctx.stdout).to.equal('foobar\n') | ||
expect(ctx.stderr).to.contain('Warning: token will expire today') | ||
}) | ||
|
||
test | ||
.env({HEROKU_API_KEY: 'foobar'}) | ||
.nock('https://api.heroku.com', api => api | ||
.get('/oauth/authorizations') | ||
.reply(200, [ | ||
{access_token: {token: 'somethingelse'}}, | ||
{access_token: {token: 'foobar', expires_in: 60}, user: {email: '[email protected]'}}, | ||
{}, | ||
]), | ||
) | ||
.stdout() | ||
.stderr() | ||
.command(['auth:token']) | ||
.it('shows "long-term" token generation warning for non-internal users', ctx => { | ||
expect(ctx.stdout).to.equal('foobar\n') | ||
expect(ctx.stderr).to.contain('To generate a long-lived token, use heroku authorizations:create.') | ||
expect(ctx.stderr).to.not.contain('All tokens expire one year after we generate it.') | ||
}) | ||
|
||
test | ||
.env({HEROKU_API_KEY: 'foobar'}) | ||
.nock('https://api.heroku.com', api => api | ||
.get('/oauth/authorizations') | ||
.reply(200, [ | ||
{access_token: {token: 'somethingelse'}}, | ||
{access_token: {token: 'foobar', expires_in: 60}, user: {email: '[email protected]'}}, | ||
{}, | ||
]), | ||
) | ||
.stdout() | ||
.stderr() | ||
.command(['auth:token']) | ||
.it('shows AT2 token generation warning for internal users', ctx => { | ||
expect(ctx.stdout).to.equal('foobar\n') | ||
expect(ctx.stderr).to.contain('All tokens expire one year after we generate it.') | ||
expect(ctx.stderr).to.not.contain('To generate a long-lived token, use heroku authorizations:create.') | ||
}) | ||
}) |