@@ -6,18 +6,17 @@ import (
66
77 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
88 "github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
9- "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
109
1110 "github.com/google/go-cmp/cmp"
1211 "github.com/google/go-cmp/cmp/cmpopts"
1312 "github.com/google/uuid"
14- "github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
13+ postgresflex "github.com/stackitcloud/stackit-sdk-go/services/postgresflex/v2api "
1514)
1615
1716type testCtxKey struct {}
1817
1918var testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
20- var testClient = & postgresflex.APIClient {}
19+ var testClient = & postgresflex.APIClient {DefaultAPI : & postgresflex. DefaultAPIService {} }
2120var testProjectId = uuid .NewString ()
2221var testInstanceId = uuid .NewString ()
2322var testSchedule = "0 0 * * *"
@@ -43,8 +42,8 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4342 Region : testRegion ,
4443 Verbosity : globalflags .VerbosityDefault ,
4544 },
46- InstanceId : utils . Ptr ( testInstanceId ) ,
47- BackupSchedule : & testSchedule ,
45+ InstanceId : testInstanceId ,
46+ BackupSchedule : testSchedule ,
4847 }
4948 for _ , mod := range mods {
5049 mod (model )
@@ -54,7 +53,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
5453
5554func fixturePayload (mods ... func (payload * postgresflex.UpdateBackupSchedulePayload )) postgresflex.UpdateBackupSchedulePayload {
5655 payload := postgresflex.UpdateBackupSchedulePayload {
57- BackupSchedule : utils . Ptr ( testSchedule ) ,
56+ BackupSchedule : testSchedule ,
5857 }
5958 for _ , mod := range mods {
6059 mod (& payload )
@@ -63,7 +62,7 @@ func fixturePayload(mods ...func(payload *postgresflex.UpdateBackupSchedulePaylo
6362}
6463
6564func fixtureRequest (mods ... func (request * postgresflex.ApiUpdateBackupScheduleRequest )) postgresflex.ApiUpdateBackupScheduleRequest {
66- request := testClient .UpdateBackupSchedule (testCtx , testProjectId , testRegion , testInstanceId )
65+ request := testClient .DefaultAPI . UpdateBackupSchedule (testCtx , testProjectId , testRegion , testInstanceId )
6766 request = request .UpdateBackupSchedulePayload (fixturePayload ())
6867 for _ , mod := range mods {
6968 mod (& request )
@@ -167,9 +166,9 @@ func TestBuildRequest(t *testing.T) {
167166 ProjectId : testProjectId ,
168167 Region : testRegion ,
169168 },
170- InstanceId : utils . Ptr ( testInstanceId ) ,
169+ InstanceId : testInstanceId ,
171170 },
172- expectedRequest : testClient .UpdateBackupSchedule (testCtx , testProjectId , testRegion , testInstanceId ).
171+ expectedRequest : testClient .DefaultAPI . UpdateBackupSchedule (testCtx , testProjectId , testRegion , testInstanceId ).
173172 UpdateBackupSchedulePayload (postgresflex.UpdateBackupSchedulePayload {}),
174173 },
175174 }
@@ -180,7 +179,7 @@ func TestBuildRequest(t *testing.T) {
180179
181180 diff := cmp .Diff (request , tt .expectedRequest ,
182181 cmp .AllowUnexported (tt .expectedRequest ),
183- cmpopts .EquateComparable (testCtx ),
182+ cmpopts .EquateComparable (testCtx , postgresflex. DefaultAPIService {} ),
184183 )
185184 if diff != "" {
186185 t .Fatalf ("Data does not match: %s" , diff )
0 commit comments