mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
37 lines
811 B
Go
37 lines
811 B
Go
package handlers_test
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"google.golang.org/protobuf/types/known/structpb"
|
|
|
|
"github.com/pomerium/pomerium/internal/handlers"
|
|
"github.com/pomerium/pomerium/pkg/grpc/identity"
|
|
)
|
|
|
|
func TestUserInfoData(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
claims, _ := structpb.NewStruct(map[string]any{
|
|
"TEST": "VALUE",
|
|
})
|
|
data := handlers.UserInfoData{Profile: &identity.Profile{Claims: claims}}
|
|
m := data.ToJSON()
|
|
bs, err := json.Marshal(m)
|
|
assert.NoError(t, err)
|
|
assert.JSONEq(t, `{
|
|
"csrfToken": "",
|
|
"isEnterprise": false,
|
|
"isImpersonated": false,
|
|
"profile": {
|
|
"claims": {"TEST":"VALUE"}
|
|
},
|
|
"session": null,
|
|
"user": null,
|
|
"webAuthnCreationOptions": null,
|
|
"webAuthnRequestOptions": null,
|
|
"webAuthnUrl": ""
|
|
}`, string(bs))
|
|
}
|