Skip to content

Commit

Permalink
chore: address linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
scop authored and kangasta committed Jan 31, 2025
1 parent 28ff198 commit f31f8f7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion internal/commands/tokens/create.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package tokens

import (
"fmt"
"time"

"fmt"
"github.com/UpCloudLtd/upcloud-cli/v3/internal/commands"
"github.com/UpCloudLtd/upcloud-cli/v3/internal/output"
"github.com/UpCloudLtd/upcloud-cli/v3/internal/ui"
Expand Down
10 changes: 5 additions & 5 deletions internal/commands/tokens/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tokens

import (
"testing"
"time"

"github.com/UpCloudLtd/upcloud-cli/v3/internal/commands"
"github.com/UpCloudLtd/upcloud-cli/v3/internal/config"
Expand All @@ -12,7 +13,6 @@ import (
"github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/request"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"time"
)

func TestCreateToken(t *testing.T) {
Expand Down Expand Up @@ -55,7 +55,7 @@ func TestCreateToken(t *testing.T) {
args: []string{
"--expires-in", "1h",
},
errFn: func(t assert.TestingT, err error, i ...interface{}) bool {
errFn: func(t assert.TestingT, err error, _ ...interface{}) bool {
return assert.ErrorContains(t, err, `required flag(s) "name" not set`)
},
},
Expand All @@ -65,7 +65,7 @@ func TestCreateToken(t *testing.T) {
"--name", "test",
"--expires-in", "seppo",
},
errFn: func(t assert.TestingT, err error, i ...interface{}) bool {
errFn: func(t assert.TestingT, err error, _ ...interface{}) bool {
return assert.ErrorContains(t, err, `invalid argument "seppo" for "--expires-in"`)
},
},
Expand All @@ -75,7 +75,7 @@ func TestCreateToken(t *testing.T) {
"--name", "test",
"--expires-at", "seppo",
},
errFn: func(t assert.TestingT, err error, i ...interface{}) bool {
errFn: func(t assert.TestingT, err error, _ ...interface{}) bool {
return assert.ErrorContains(t, err, `invalid expires-at: `)
},
},
Expand All @@ -84,7 +84,7 @@ func TestCreateToken(t *testing.T) {
args: []string{
"--name", "test",
},
errFn: func(t assert.TestingT, err error, i ...interface{}) bool {
errFn: func(t assert.TestingT, err error, _ ...interface{}) bool {
return assert.ErrorContains(t, err, `either expires-in or expires-at must be set`)
},
},
Expand Down
9 changes: 3 additions & 6 deletions internal/commands/tokens/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@ import (
)

func TestDeleteCommand(t *testing.T) {
tokenID := "0cdabbf9-090b-4fc5-a6ae-3f76801ed171"

svc := &smock.Service{}
conf := config.New()
dr := &request.DeleteTokenRequest{ID: "0cdabbf9-090b-4fc5-a6ae-3f76801ed171"}

svc.On("DeleteToken",
&request.DeleteTokenRequest{ID: tokenID},
).Once().Return(nil)
svc.On("DeleteToken", dr).Once().Return(nil)

command := commands.BuildCommand(DeleteCommand(), nil, conf)
_, err := command.(commands.MultipleArgumentCommand).Execute(commands.NewExecutor(conf, svc, flume.New("test")), tokenID)
_, err := command.(commands.MultipleArgumentCommand).Execute(commands.NewExecutor(conf, svc, flume.New("test")), dr.ID)
assert.NoError(t, err)

svc.AssertExpectations(t)
Expand Down
4 changes: 2 additions & 2 deletions internal/testutils/time.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package testutils

import (
"github.com/stretchr/testify/require"
"testing"

"time"

"github.com/stretchr/testify/require"
)

func MustParseRFC3339(t *testing.T, timeStr string) *time.Time {
Expand Down

0 comments on commit f31f8f7

Please sign in to comment.