2023-03-15 12:00:52 -04:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-10 21:14:03 -04:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-15 12:00:52 -04:00
|
|
|
|
2015-03-29 19:42:45 -04:00
|
|
|
package command
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
2023-12-04 14:05:02 -05:00
|
|
|
"github.com/hashicorp/cli"
|
2017-09-04 23:59:24 -04:00
|
|
|
"github.com/hashicorp/vault/command/token"
|
2015-03-29 19:42:45 -04:00
|
|
|
)
|
|
|
|
|
|
2017-09-04 23:59:24 -04:00
|
|
|
func testAuthCommand(tb testing.TB) (*cli.MockUi, *AuthCommand) {
|
|
|
|
|
tb.Helper()
|
2015-03-30 13:55:41 -04:00
|
|
|
|
2017-09-04 23:59:24 -04:00
|
|
|
ui := cli.NewMockUi()
|
|
|
|
|
return ui, &AuthCommand{
|
|
|
|
|
BaseCommand: &BaseCommand{
|
|
|
|
|
UI: ui,
|
2015-03-30 13:55:41 -04:00
|
|
|
|
2017-09-04 23:59:24 -04:00
|
|
|
// Override to our own token helper
|
|
|
|
|
tokenHelper: token.NewTestingTokenHelper(),
|
2017-08-31 16:57:00 -04:00
|
|
|
},
|
|
|
|
|
}
|
2017-09-04 23:59:24 -04:00
|
|
|
}
|
2017-08-31 16:57:00 -04:00
|
|
|
|
2017-09-04 23:59:24 -04:00
|
|
|
func TestAuthCommand_Run(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
|
|
|
|
|
t.Run("no_tabs", func(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
2015-04-06 12:40:47 -04:00
|
|
|
|
2017-09-04 23:59:24 -04:00
|
|
|
_, cmd := testAuthCommand(t)
|
|
|
|
|
assertNoTabs(t, cmd)
|
|
|
|
|
})
|
2015-04-06 12:40:47 -04:00
|
|
|
}
|