| 1 |
//go:build go1.20 |
| 2 |
|
| 3 |
package oidc |
| 4 |
|
| 5 |
import ( |
| 6 |
"log/slog" |
| 7 |
"testing" |
| 8 |
|
| 9 |
"github.com/stretchr/testify/assert" |
| 10 |
) |
| 11 |
|
| 12 |
func TestAuthRequest_LogValue(t *testing.T) { |
| 13 |
a := &AuthRequest{ |
| 14 |
Scopes: SpaceDelimitedArray{"a", "b"}, |
| 15 |
ResponseType: "respType", |
| 16 |
ClientID: "123", |
| 17 |
RedirectURI: "http://example.com/callback", |
| 18 |
} |
| 19 |
want := slog.GroupValue( |
| 20 |
slog.Any("scopes", SpaceDelimitedArray{"a", "b"}), |
| 21 |
slog.String("response_type", "respType"), |
| 22 |
slog.String("client_id", "123"), |
| 23 |
slog.String("redirect_uri", "http://example.com/callback"), |
| 24 |
) |
| 25 |
got := a.LogValue() |
| 26 |
assert.Equal(t, want, got) |
| 27 |
} |