@@ -15,17 +15,17 @@ import (
1515 "github.com/stackitcloud/stackit-sdk-go/services/serviceenablement"
1616)
1717
18- var projectIdFlag = globalflags .ProjectIdFlag
19-
2018type testCtxKey struct {}
2119
2220var testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
2321var testClient = & serviceenablement.APIClient {}
2422var testProjectId = uuid .NewString ()
23+ var testRegion = "eu01"
2524
2625func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
2726 flagValues := map [string ]string {
28- projectIdFlag : testProjectId ,
27+ globalflags .ProjectIdFlag : testProjectId ,
28+ globalflags .RegionFlag : testRegion ,
2929 }
3030 for _ , mod := range mods {
3131 mod (flagValues )
@@ -37,6 +37,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
3737 model := & inputModel {
3838 GlobalFlagModel : & globalflags.GlobalFlagModel {
3939 ProjectId : testProjectId ,
40+ Region : testRegion ,
4041 Verbosity : globalflags .VerbosityDefault ,
4142 },
4243 }
@@ -46,8 +47,8 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
4647 return model
4748}
4849
49- func fixtureRequest (mods ... func (request * serviceenablement.ApiDisableServiceRequest )) serviceenablement.ApiDisableServiceRequest {
50- request := testClient .DisableService (testCtx , testProjectId , utils .SKEServiceId )
50+ func fixtureRequest (mods ... func (request * serviceenablement.ApiDisableServiceRegionalRequest )) serviceenablement.ApiDisableServiceRegionalRequest {
51+ request := testClient .DisableServiceRegional (testCtx , testRegion , testProjectId , utils .SKEServiceId )
5152 for _ , mod := range mods {
5253 mod (& request )
5354 }
@@ -75,21 +76,21 @@ func TestParseInput(t *testing.T) {
7576 {
7677 description : "project id missing" ,
7778 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
78- delete (flagValues , projectIdFlag )
79+ delete (flagValues , globalflags . ProjectIdFlag )
7980 }),
8081 isValid : false ,
8182 },
8283 {
8384 description : "project id invalid 1" ,
8485 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
85- flagValues [projectIdFlag ] = ""
86+ flagValues [globalflags . ProjectIdFlag ] = ""
8687 }),
8788 isValid : false ,
8889 },
8990 {
9091 description : "project id invalid 2" ,
9192 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
92- flagValues [projectIdFlag ] = "invalid-uuid"
93+ flagValues [globalflags . ProjectIdFlag ] = "invalid-uuid"
9394 }),
9495 isValid : false ,
9596 },
@@ -145,7 +146,7 @@ func TestBuildRequest(t *testing.T) {
145146 tests := []struct {
146147 description string
147148 model * inputModel
148- expectedRequest serviceenablement.ApiDisableServiceRequest
149+ expectedRequest serviceenablement.ApiDisableServiceRegionalRequest
149150 }{
150151 {
151152 description : "base" ,
0 commit comments