@@ -12,8 +12,6 @@ import (
1212 "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex"
1313)
1414
15- var projectIdFlag = globalflags .ProjectIdFlag
16-
1715type testCtxKey struct {}
1816
1917var testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
@@ -22,6 +20,7 @@ var testProjectId = uuid.NewString()
2220var testInstanceId = uuid .NewString ()
2321var testDatabaseName = "my-database"
2422var testOwner = "owner"
23+ var testRegion = "eu01"
2524
2625func fixtureArgValues (mods ... func (argValues []string )) []string {
2726 argValues := []string {
@@ -35,9 +34,10 @@ 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- instanceIdFlag : testInstanceId ,
40- ownerFlag : testOwner ,
37+ globalflags .ProjectIdFlag : testProjectId ,
38+ globalflags .RegionFlag : testRegion ,
39+ instanceIdFlag : testInstanceId ,
40+ ownerFlag : testOwner ,
4141 }
4242 for _ , mod := range mods {
4343 mod (flagValues )
@@ -50,6 +50,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
5050 GlobalFlagModel : & globalflags.GlobalFlagModel {
5151 ProjectId : testProjectId ,
5252 Verbosity : globalflags .VerbosityDefault ,
53+ Region : testRegion ,
5354 },
5455 DatabaseName : testDatabaseName ,
5556 InstanceId : testInstanceId ,
@@ -62,7 +63,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
6263}
6364
6465func fixtureRequest (mods ... func (request * sqlserverflex.ApiCreateDatabaseRequest )) sqlserverflex.ApiCreateDatabaseRequest {
65- request := testClient .CreateDatabase (testCtx , testProjectId , testInstanceId )
66+ request := testClient .CreateDatabase (testCtx , testProjectId , testInstanceId , testRegion )
6667 payload := sqlserverflex.CreateDatabasePayload {
6768 Name : & testDatabaseName ,
6869 Options : & sqlserverflex.DatabaseDocumentationCreateDatabaseRequestOptions {
@@ -113,23 +114,23 @@ func TestParseInput(t *testing.T) {
113114 description : "project id missing" ,
114115 argValues : fixtureArgValues (),
115116 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
116- delete (flagValues , projectIdFlag )
117+ delete (flagValues , globalflags . ProjectIdFlag )
117118 }),
118119 isValid : false ,
119120 },
120121 {
121122 description : "project id invalid 1" ,
122123 argValues : fixtureArgValues (),
123124 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
124- flagValues [projectIdFlag ] = ""
125+ flagValues [globalflags . ProjectIdFlag ] = ""
125126 }),
126127 isValid : false ,
127128 },
128129 {
129130 description : "project id invalid 2" ,
130131 argValues : fixtureArgValues (),
131132 flagValues : fixtureFlagValues (func (flagValues map [string ]string ) {
132- flagValues [projectIdFlag ] = "invalid-uuid"
133+ flagValues [globalflags . ProjectIdFlag ] = "invalid-uuid"
133134 }),
134135 isValid : false ,
135136 },
0 commit comments