@@ -14,14 +14,16 @@ import (
1414)
1515
1616var projectIdFlag = globalflags .ProjectIdFlag
17+ var regionFlag = globalflags .RegionFlag
1718
1819type testCtxKey struct {}
1920
2021var testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
21- var testClient = & logme.APIClient {}
22+ var testClient = & logme.APIClient {DefaultAPI : & logme. DefaultAPIService {} }
2223var testProjectId = uuid .NewString ()
2324var testInstanceId = uuid .NewString ()
2425var testCredentialsId = uuid .NewString ()
26+ var testRegion = "region"
2527
2628func fixtureArgValues (mods ... func (argValues []string )) []string {
2729 argValues := []string {
@@ -37,6 +39,7 @@ func fixtureFlagValues(mods ...func(flagValues map[string]string)) map[string]st
3739 flagValues := map [string ]string {
3840 projectIdFlag : testProjectId ,
3941 instanceIdFlag : testInstanceId ,
42+ regionFlag : testRegion ,
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 * logme.ApiDeleteCredentialsRequest )) logme.ApiDeleteCredentialsRequest {
63- request := testClient .DeleteCredentials (testCtx , testProjectId , testInstanceId , testCredentialsId )
67+ request := testClient .DefaultAPI . DeleteCredentials (testCtx , testProjectId , testRegion , testInstanceId , testCredentialsId )
6468 for _ , mod := range mods {
6569 mod (& request )
6670 }
@@ -188,7 +192,7 @@ func TestBuildRequest(t *testing.T) {
188192
189193 diff := cmp .Diff (request , tt .expectedRequest ,
190194 cmp .AllowUnexported (tt .expectedRequest ),
191- cmpopts .EquateComparable (testCtx ),
195+ cmpopts .EquateComparable (testCtx , logme. ApiDeleteCredentialsRequest {} ),
192196 )
193197 if diff != "" {
194198 t .Fatalf ("Data does not match: %s" , diff )
0 commit comments