fix all tests

This commit is contained in:
Shreyas Goenka 2025-03-06 13:17:54 +01:00
parent 31a0ec9a93
commit 4d0cdeecf4
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
3 changed files with 10 additions and 10 deletions

View File

@ -129,7 +129,7 @@ func TestTokenCmdWithHostPrintsHelpfulLoginMessageOnRefreshFailure(t *testing.T)
func TestTokenCmdInvalidResponse(t *testing.T) {
cmd, output := getCobraCmdForTest(refreshFailureInvalidResponse)
cmd.SetArgs([]string{"auth", "token", "--profile", "active"})
err := cmd.Execute()
err := root.Execute(cmd.Context(), cmd)
out := output.String()
assert.Empty(t, out)
@ -140,7 +140,7 @@ func TestTokenCmdInvalidResponse(t *testing.T) {
func TestTokenCmdOtherErrorResponse(t *testing.T) {
cmd, output := getCobraCmdForTest(refreshFailureOtherError)
cmd.SetArgs([]string{"auth", "token", "--profile", "active"})
err := cmd.Execute()
err := root.Execute(cmd.Context(), cmd)
out := output.String()
assert.Empty(t, out)
@ -151,7 +151,7 @@ func TestTokenCmdOtherErrorResponse(t *testing.T) {
func TestTokenCmdWithProfileSuccess(t *testing.T) {
cmd, output := getCobraCmdForTest(refreshSuccessTokenResponse)
cmd.SetArgs([]string{"auth", "token", "--profile", "active"})
err := cmd.Execute()
err := root.Execute(cmd.Context(), cmd)
out := output.String()
validateToken(t, out)
@ -161,7 +161,7 @@ func TestTokenCmdWithProfileSuccess(t *testing.T) {
func TestTokenCmdWithHostSuccess(t *testing.T) {
cmd, output := getCobraCmdForTest(refreshSuccessTokenResponse)
cmd.SetArgs([]string{"auth", "token", "--host", "https://accounts.cloud.databricks.com", "--account-id", "expired"})
err := cmd.Execute()
err := root.Execute(cmd.Context(), cmd)
out := output.String()
validateToken(t, out)

View File

@ -132,7 +132,7 @@ func TestEnvVarsConfigureNoInteractive(t *testing.T) {
cmd := cmd.New(ctx)
cmd.SetArgs([]string{"configure", "--token"})
err := cmd.ExecuteContext(ctx)
err := root.Execute(ctx, cmd)
assert.NoError(t, err)
_, err = os.Stat(cfgPath)
@ -165,7 +165,7 @@ func TestEnvVarsConfigureNoArgsNoInteractive(t *testing.T) {
cmd := cmd.New(ctx)
cmd.SetArgs([]string{"configure"})
err := cmd.ExecuteContext(ctx)
err := root.Execute(ctx, cmd)
assert.NoError(t, err)
_, err = os.Stat(cfgPath)
@ -194,7 +194,7 @@ func TestCustomProfileConfigureNoInteractive(t *testing.T) {
cmd := cmd.New(ctx)
cmd.SetArgs([]string{"configure", "--token", "--host", "https://host", "--profile", "CUSTOM"})
err := cmd.ExecuteContext(ctx)
err := root.Execute(ctx, cmd)
assert.NoError(t, err)
_, err = os.Stat(cfgPath)

View File

@ -212,7 +212,7 @@ func TestTargetFlagFull(t *testing.T) {
cmd.SetArgs([]string{"version", "--target", "development"})
ctx := context.Background()
err := cmd.ExecuteContext(ctx)
err := root.Execute(ctx, cmd)
assert.NoError(t, err)
assert.Equal(t, "development", getTarget(cmd))
@ -224,7 +224,7 @@ func TestTargetFlagShort(t *testing.T) {
cmd.SetArgs([]string{"version", "-t", "production"})
ctx := context.Background()
err := cmd.ExecuteContext(ctx)
err := root.Execute(ctx, cmd)
assert.NoError(t, err)
assert.Equal(t, "production", getTarget(cmd))
@ -238,7 +238,7 @@ func TestTargetEnvironmentFlag(t *testing.T) {
cmd.SetArgs([]string{"version", "--environment", "development"})
ctx := context.Background()
err := cmd.ExecuteContext(ctx)
err := root.Execute(ctx, cmd)
assert.NoError(t, err)
assert.Equal(t, "development", getTarget(cmd))