@@ -4,23 +4,22 @@ import (
44 "context"
55 "testing"
66
7- "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
8- "github.com/stackitcloud/stackit-cli/internal/pkg/testparams"
9- "github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
10- "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
11-
127 "github.com/google/go-cmp/cmp"
138 "github.com/google/go-cmp/cmp/cmpopts"
149 "github.com/google/uuid"
15- "github.com/stackitcloud/stackit-sdk-go/services/serviceaccount"
10+ serviceaccount "github.com/stackitcloud/stackit-sdk-go/services/serviceaccount/v2api"
11+
12+ "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
13+ "github.com/stackitcloud/stackit-cli/internal/pkg/testparams"
14+ "github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
1615)
1716
1817var projectIdFlag = globalflags .ProjectIdFlag
1918
2019type testCtxKey struct {}
2120
2221var testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
23- var testClient = & serviceaccount.APIClient {}
22+ var testClient = & serviceaccount.APIClient {DefaultAPI : & serviceaccount. DefaultAPIService {} }
2423var testProjectId = uuid .NewString ()
2524
2625func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
@@ -40,7 +39,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4039 ProjectId : testProjectId ,
4140 Verbosity : globalflags .VerbosityDefault ,
4241 },
43- Name : utils . Ptr ( "example" ) ,
42+ Name : "example" ,
4443 }
4544 for _ , mod := range mods {
4645 mod (model )
@@ -49,9 +48,9 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4948}
5049
5150func fixtureRequest (mods ... func (request * serviceaccount.ApiCreateServiceAccountRequest )) serviceaccount.ApiCreateServiceAccountRequest {
52- request := testClient .CreateServiceAccount (testCtx , testProjectId )
51+ request := testClient .DefaultAPI . CreateServiceAccount (testCtx , testProjectId )
5352 request = request .CreateServiceAccountPayload (serviceaccount.CreateServiceAccountPayload {
54- Name : utils . Ptr ( "example" ) ,
53+ Name : "example" ,
5554 })
5655 for _ , mod := range mods {
5756 mod (& request )
@@ -90,7 +89,7 @@ func TestParseInput(t *testing.T) {
9089 ProjectId : testProjectId ,
9190 Verbosity : globalflags .VerbosityDefault ,
9291 },
93- Name : utils . Ptr ( "" ) ,
92+ Name : "" ,
9493 },
9594 },
9695 {
@@ -142,7 +141,7 @@ func TestBuildRequest(t *testing.T) {
142141
143142 diff := cmp .Diff (request , tt .expectedRequest ,
144143 cmp .AllowUnexported (tt .expectedRequest ),
145- cmpopts .EquateComparable (testCtx ),
144+ cmpopts .EquateComparable (testCtx , serviceaccount. DefaultAPIService {} ),
146145 )
147146 if diff != "" {
148147 t .Fatalf ("Data does not match: %s" , diff )
0 commit comments