@@ -10,18 +10,20 @@ import (
1010 "github.com/google/go-cmp/cmp"
1111 "github.com/google/go-cmp/cmp/cmpopts"
1212 "github.com/google/uuid"
13- mariadb "github.com/stackitcloud/stackit-sdk-go/services/mariadb/v1api "
13+ mariadb "github.com/stackitcloud/stackit-sdk-go/services/mariadb/v2api "
1414)
1515
16- var projectIdFlag = globalflags .ProjectIdFlag
17-
1816type testCtxKey struct {}
1917
20- var testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
21- var testClient = & mariadb.APIClient {DefaultAPI : & mariadb.DefaultAPIService {}}
22- var testProjectId = uuid .NewString ()
23- var testInstanceId = uuid .NewString ()
24- var testCredentialsId = uuid .NewString ()
18+ var (
19+ testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
20+ testClient = & mariadb.APIClient {DefaultAPI : & mariadb.DefaultAPIService {}}
21+ testProjectId = uuid .NewString ()
22+ testInstanceId = uuid .NewString ()
23+ testCredentialsId = uuid .NewString ()
24+ )
25+
26+ const testRegion = "eu01"
2527
2628func fixtureArgValues (mods ... func (argValues []string )) []string {
2729 argValues := []string {
@@ -35,8 +37,9 @@ func fixtureArgValues(mods ...func(argValues []string)) []string {
3537
3638func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
3739 flagValues := map [string ]string {
38- projectIdFlag : testProjectId ,
39- instanceIdFlag : testInstanceId ,
40+ globalflags .ProjectIdFlag : testProjectId ,
41+ globalflags .RegionFlag : testRegion ,
42+ instanceIdFlag : testInstanceId ,
4043 }
4144 for _ , mod := range mods {
4245 mod (flagValues )
@@ -48,6 +51,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4851 model := & inputModel {
4952 GlobalFlagModel : & globalflags.GlobalFlagModel {
5053 ProjectId : testProjectId ,
54+ Region : testRegion ,
5155 Verbosity : globalflags .VerbosityDefault ,
5256 },
5357 InstanceId : testInstanceId ,
@@ -60,7 +64,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
6064}
6165
6266func fixtureRequest (mods ... func (request * mariadb.ApiDeleteCredentialsRequest )) mariadb.ApiDeleteCredentialsRequest {
63- request := testClient .DefaultAPI .DeleteCredentials (testCtx , testProjectId , testInstanceId , testCredentialsId )
67+ request := testClient .DefaultAPI .DeleteCredentials (testCtx , testProjectId , testRegion , testInstanceId , testCredentialsId )
6468 for _ , mod := range mods {
6569 mod (& request )
6670 }
@@ -104,23 +108,23 @@ func TestParseInput(t *testing.T) {
104108 description : "project id missing" ,
105109 argValues : fixtureArgValues (),
106110 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
107- delete (flagValues , projectIdFlag )
111+ delete (flagValues , globalflags . ProjectIdFlag )
108112 }),
109113 isValid : false ,
110114 },
111115 {
112116 description : "project id invalid 1" ,
113117 argValues : fixtureArgValues (),
114118 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
115- flagValues [projectIdFlag ] = ""
119+ flagValues [globalflags . ProjectIdFlag ] = ""
116120 }),
117121 isValid : false ,
118122 },
119123 {
120124 description : "project id invalid 2" ,
121125 argValues : fixtureArgValues (),
122126 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
123- flagValues [projectIdFlag ] = "invalid-uuid"
127+ flagValues [globalflags . ProjectIdFlag ] = "invalid-uuid"
124128 }),
125129 isValid : false ,
126130 },
0 commit comments