@@ -18,15 +18,17 @@ import (
1818type testCtxKey struct {}
1919
2020var testCtx = context .WithValue (context .Background (), testCtxKey {}, "foo" )
21- var testClient = & logme.APIClient {}
21+ var testClient = & logme.APIClient {DefaultAPI : & logme. DefaultAPIService {} }
2222var testProjectId = uuid .NewString ()
2323var testInstanceId = uuid .NewString ()
24+ var testRegion = "region"
2425
2526func fixtureFlagValues (mods ... func (flagValues map [string ]string )) map [string ]string {
2627 flagValues := map [string ]string {
2728 globalflags .ProjectIdFlag : testProjectId ,
2829 instanceIdFlag : testInstanceId ,
2930 limitFlag : "10" ,
31+ globalflags .RegionFlag : testRegion ,
3032 }
3133 for _ , mod := range mods {
3234 mod (flagValues )
@@ -38,6 +40,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
3840 model := & inputModel {
3941 GlobalFlagModel : & globalflags.GlobalFlagModel {
4042 ProjectId : testProjectId ,
43+ Region : testRegion ,
4144 Verbosity : globalflags .VerbosityDefault ,
4245 },
4346 InstanceId : testInstanceId ,
@@ -50,7 +53,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
5053}
5154
5255func fixtureRequest (mods ... func (request * logme.ApiListCredentialsRequest )) logme.ApiListCredentialsRequest {
53- request := testClient .ListCredentials (testCtx , testProjectId , testInstanceId )
56+ request := testClient .DefaultAPI . ListCredentials (testCtx , testProjectId , testRegion , testInstanceId )
5457 for _ , mod := range mods {
5558 mod (& request )
5659 }
@@ -160,7 +163,7 @@ func TestBuildRequest(t *testing.T) {
160163
161164 diff := cmp .Diff (request , tt .expectedRequest ,
162165 cmp .AllowUnexported (tt .expectedRequest ),
163- cmpopts .EquateComparable (testCtx ),
166+ cmpopts .EquateComparable (testCtx , logme. ApiListCredentialsRequest {} ),
164167 )
165168 if diff != "" {
166169 t .Fatalf ("Data does not match: %s" , diff )
0 commit comments