77 "github.com/stackitcloud/stackit-cli/internal/cmd/params"
88 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
99 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
10+ "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1011
1112 "github.com/google/go-cmp/cmp"
1213 "github.com/google/go-cmp/cmp/cmpopts"
@@ -16,21 +17,24 @@ import (
1617
1718type testCtxKey struct {}
1819
19- var (
20- testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
21- testClient = & iaas.APIClient {}
22- testProjectId = uuid .NewString ()
23- testSourceId = uuid .NewString ()
20+ const (
2421 testName = "my-backup"
25- testLabels = map [string ]string {"key1" : "value1" }
2622 testSourceType = "volume"
2723)
2824
25+ var (
26+ testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
27+ testClient = & iaas.APIClient {}
28+ testProjectId = uuid .NewString ()
29+ testSourceId = uuid .NewString ()
30+ testLabels = map [string ]string {"key1" : "value1" }
31+ )
32+
2933func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
3034 flagValues := map [string ]string {
3135 globalflags .ProjectIdFlag : testProjectId ,
3236 sourceIdFlag : testSourceId ,
33- sourceTypeFlag : "volume" ,
37+ sourceTypeFlag : testSourceType ,
3438 nameFlag : testName ,
3539 labelsFlag : "key1=value1" ,
3640 }
@@ -47,8 +51,8 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4751 Verbosity : globalflags .VerbosityDefault ,
4852 },
4953 SourceID : testSourceId ,
50- SourceType : "volume" ,
51- Name : & testName ,
54+ SourceType : testSourceType ,
55+ Name : utils . Ptr ( testName ) ,
5256 Labels : testLabels ,
5357 }
5458 for _ , mod := range mods {
@@ -61,13 +65,13 @@ func fixtureRequest(mods ...func(request *iaas.ApiCreateBackupRequest)) iaas.Api
6165 request := testClient .CreateBackup (testCtx , testProjectId )
6266
6367 createPayload := iaas .NewCreateBackupPayloadWithDefaults ()
64- createPayload .Name = & testName
68+ createPayload .Name = utils . Ptr ( testName )
6569 createPayload .Labels = & map [string ]interface {}{
6670 "key1" : "value1" ,
6771 }
6872 createPayload .Source = & iaas.BackupSource {
6973 Id : & testSourceId ,
70- Type : & testSourceType ,
74+ Type : utils . Ptr ( testSourceType ) ,
7175 }
7276
7377 request = request .CreateBackupPayload (* createPayload )
0 commit comments