zero: only leave public packages in pkg/zero (#4854)

This commit is contained in:
Denis Mishin 2023-12-12 14:24:37 -05:00 committed by GitHub
parent a6ae9d3f2d
commit b66634d1e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 22 additions and 22 deletions

View file

@ -0,0 +1,40 @@
package apierror_test
import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
"github.com/pomerium/pomerium/internal/zero/apierror"
"github.com/pomerium/pomerium/pkg/zero/cluster"
)
func TestResponse(t *testing.T) {
t.Parallel()
for _, tc := range []struct {
name string
err error
response apierror.APIResponse[cluster.ExchangeTokenResponse]
wantVal *cluster.ExchangeTokenResponse
wantErr error
}{
{
name: "success",
response: &cluster.ExchangeClusterIdentityTokenResp{
HTTPResponse: &http.Response{},
JSON200: &cluster.ExchangeTokenResponse{},
},
err: nil,
wantVal: &cluster.ExchangeTokenResponse{},
wantErr: nil,
},
} {
t.Run(tc.name, func(t *testing.T) {
gotVal, gotErr := apierror.CheckResponse(tc.response, tc.err)
assert.Equal(t, tc.wantVal, gotVal)
assert.Equal(t, tc.wantErr, gotErr)
})
}
}