77 "github.com/google/go-cmp/cmp"
88 "github.com/google/go-cmp/cmp/cmpopts"
99 "github.com/google/uuid"
10- "github.com/stackitcloud/stackit-sdk-go/services/git"
10+ git "github.com/stackitcloud/stackit-sdk-go/services/git/v1betaapi "
1111
1212 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1313 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
@@ -20,7 +20,7 @@ type testCtxKey struct{}
2020
2121var (
2222 testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
23- testClient = & git.APIClient {}
23+ testClient = & git.APIClient {DefaultAPI : & git. DefaultAPIService {} }
2424 testProjectId = uuid .NewString ()
2525
2626 testName = "test-instance"
@@ -57,9 +57,9 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
5757
5858func fixtureCreatePayload (mods ... func (payload * git.CreateInstancePayload )) (payload git.CreateInstancePayload ) {
5959 payload = git.CreateInstancePayload {
60- Name : & testName ,
61- Flavor : git .CreateInstancePayloadGetFlavorAttributeType ( & testFlavor ),
62- Acl : & testAcl ,
60+ Name : testName ,
61+ Flavor : utils . Ptr ( git .CreateInstancePayloadFlavor ( testFlavor ) ),
62+ Acl : testAcl ,
6363 }
6464 for _ , mod := range mods {
6565 mod (& payload )
@@ -68,7 +68,7 @@ func fixtureCreatePayload(mods ...func(payload *git.CreateInstancePayload)) (pay
6868}
6969
7070func fixtureRequest (mods ... func (request * git.ApiCreateInstanceRequest )) git.ApiCreateInstanceRequest {
71- request := testClient .CreateInstance (testCtx , testProjectId )
71+ request := testClient .DefaultAPI . CreateInstance (testCtx , testProjectId )
7272
7373 request = request .CreateInstancePayload (fixtureCreatePayload ())
7474
@@ -151,8 +151,8 @@ func TestBuildRequest(t *testing.T) {
151151 model .Name = "new-name"
152152 }),
153153 expectedRequest : fixtureRequest (func (request * git.ApiCreateInstanceRequest ) {
154- * request = ( * request ) .CreateInstancePayload (fixtureCreatePayload (func (payload * git.CreateInstancePayload ) {
155- payload .Name = utils . Ptr ( "new-name" )
154+ * request = request .CreateInstancePayload (fixtureCreatePayload (func (payload * git.CreateInstancePayload ) {
155+ payload .Name = "new-name"
156156 }))
157157 }),
158158 },
@@ -164,7 +164,7 @@ func TestBuildRequest(t *testing.T) {
164164 diff := cmp .Diff (request , tt .expectedRequest ,
165165 cmp .AllowUnexported (tt .expectedRequest ),
166166 cmpopts .EquateComparable (testCtx ),
167- cmp .AllowUnexported (git.NullableString {}),
167+ cmp .AllowUnexported (git.NullableString {}, git. DefaultAPIService {} ),
168168 )
169169 if diff != "" {
170170 t .Fatalf ("Data does not match: %s" , diff )
@@ -201,7 +201,7 @@ func TestOutputResult(t *testing.T) {
201201 outputFormat : "" ,
202202 async : false ,
203203 instanceName : "" ,
204- resp : & git.Instance {Id : utils . Ptr ( uuid .NewString () )},
204+ resp : & git.Instance {Id : uuid .NewString ()},
205205 },
206206 wantErr : false ,
207207 },
@@ -211,7 +211,7 @@ func TestOutputResult(t *testing.T) {
211211 outputFormat : print .JSONOutputFormat ,
212212 async : true ,
213213 instanceName : testName ,
214- resp : & git.Instance {Id : utils . Ptr ( uuid .NewString () )},
214+ resp : & git.Instance {Id : uuid .NewString ()},
215215 },
216216 wantErr : false ,
217217 },
0 commit comments