@@ -15,7 +15,9 @@ import (
1515 "github.com/stackitcloud/stackit-sdk-go/services/iaas"
1616)
1717
18- var projectIdFlag = globalflags .ProjectIdFlag
18+ const (
19+ testRegion = "eu01"
20+ )
1921
2022type testCtxKey struct {}
2123
3537
3638func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
3739 flagValues := map [string ]string {
38- projectIdFlag : testProjectId ,
40+ globalflags .ProjectIdFlag : testProjectId ,
41+ globalflags .RegionFlag : testRegion ,
42+
3943 descriptionFlag : testDescription ,
4044 labelsFlag : "fooKey=fooValue,barKey=barValue,bazKey=bazValue" ,
4145 statefulFlag : "true" ,
@@ -49,11 +53,15 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st
4953
5054func fixtureInputModel (mods ... func (model * inputModel )) * inputModel {
5155 model := & inputModel {
52- GlobalFlagModel : & globalflags.GlobalFlagModel {ProjectId : testProjectId , Verbosity : globalflags .VerbosityDefault },
53- Labels : & testLabels ,
54- Description : & testDescription ,
55- Name : & testName ,
56- Stateful : & testStateful ,
56+ GlobalFlagModel : & globalflags.GlobalFlagModel {
57+ ProjectId : testProjectId ,
58+ Region : testRegion ,
59+ Verbosity : globalflags .VerbosityDefault ,
60+ },
61+ Labels : & testLabels ,
62+ Description : & testDescription ,
63+ Name : & testName ,
64+ Stateful : & testStateful ,
5765 }
5866 for _ , mod := range mods {
5967 mod (model )
@@ -72,7 +80,7 @@ func toStringAnyMapPtr(m map[string]string) map[string]any {
7280 return result
7381}
7482func fixtureRequest (mods ... func (request * iaas.ApiCreateSecurityGroupRequest )) iaas.ApiCreateSecurityGroupRequest {
75- request := testClient .CreateSecurityGroup (testCtx , testProjectId )
83+ request := testClient .CreateSecurityGroup (testCtx , testProjectId , testRegion )
7684
7785 request = request .CreateSecurityGroupPayload (iaas.CreateSecurityGroupPayload {
7886 Description : & testDescription ,
@@ -109,21 +117,21 @@ func TestParseInput(t *testing.T) {
109117 {
110118 description : "project id missing" ,
111119 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
112- delete (flagValues , projectIdFlag )
120+ delete (flagValues , globalflags . ProjectIdFlag )
113121 }),
114122 isValid : false ,
115123 },
116124 {
117125 description : "project id invalid 1" ,
118126 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
119- flagValues [projectIdFlag ] = ""
127+ flagValues [globalflags . ProjectIdFlag ] = ""
120128 }),
121129 isValid : false ,
122130 },
123131 {
124132 description : "project id invalid 2" ,
125133 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
126- flagValues [projectIdFlag ] = "invalid-uuid"
134+ flagValues [globalflags . ProjectIdFlag ] = "invalid-uuid"
127135 }),
128136 isValid : false ,
129137 },
0 commit comments