@@ -13,15 +13,14 @@ import (
1313 "github.com/stackitcloud/stackit-sdk-go/services/serverbackup"
1414)
1515
16- var projectIdFlag = globalflags .ProjectIdFlag
17-
1816type testCtxKey struct {}
1917
2018var testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
2119var testClient = & serverbackup.APIClient {}
2220var testProjectId = uuid .NewString ()
2321var testServerId = uuid .NewString ()
2422var testBackupId = uuid .NewString ()
23+ var testRegion = "eu01"
2524
2625func fixtureArgValues (mods ... func (argValues []string )) []string {
2726 argValues := []string {
@@ -35,8 +34,9 @@ func fixtureArgValues(mods ...func(argValues []string)) []string {
3534
3635func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
3736 flagValues := map [string ]string {
38- projectIdFlag : testProjectId ,
39- serverIdFlag : testServerId ,
37+ globalflags .ProjectIdFlag : testProjectId ,
38+ globalflags .RegionFlag : testRegion ,
39+ serverIdFlag : testServerId ,
4040 }
4141 for _ , mod := range mods {
4242 mod (flagValues )
@@ -48,6 +48,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4848 model := & inputModel {
4949 GlobalFlagModel : & globalflags.GlobalFlagModel {
5050 ProjectId : testProjectId ,
51+ Region : testRegion ,
5152 Verbosity : globalflags .VerbosityDefault ,
5253 },
5354 ServerId : testServerId ,
@@ -60,7 +61,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
6061}
6162
6263func fixtureRequest (mods ... func (request * serverbackup.ApiDeleteBackupRequest )) serverbackup.ApiDeleteBackupRequest {
63- request := testClient .DeleteBackup (testCtx , testProjectId , testServerId , testBackupId )
64+ request := testClient .DeleteBackup (testCtx , testProjectId , testServerId , testRegion , testBackupId )
6465 for _ , mod := range mods {
6566 mod (& request )
6667 }
@@ -104,23 +105,23 @@ func TestParseInput(t *testing.T) {
104105 description : "project id missing" ,
105106 argValues : fixtureArgValues (),
106107 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
107- delete (flagValues , projectIdFlag )
108+ delete (flagValues , globalflags . ProjectIdFlag )
108109 }),
109110 isValid : false ,
110111 },
111112 {
112113 description : "project id invalid 1" ,
113114 argValues : fixtureArgValues (),
114115 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
115- flagValues [projectIdFlag ] = ""
116+ flagValues [globalflags . ProjectIdFlag ] = ""
116117 }),
117118 isValid : false ,
118119 },
119120 {
120121 description : "project id invalid 2" ,
121122 argValues : fixtureArgValues (),
122123 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
123- flagValues [projectIdFlag ] = "invalid-uuid"
124+ flagValues [globalflags . ProjectIdFlag ] = "invalid-uuid"
124125 }),
125126 isValid : false ,
126127 },
0 commit comments