Files
Karl Persson 39d94eabcd Auth: Fix function name (#100122)
Fix spelling
2025-02-05 15:32:22 +01:00

25 lines
621 B
Go

package resource
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/grafana/grafana/pkg/apimachinery/identity"
)
func TestIDTokenExtractor(t *testing.T) {
t.Run("should return an error when no claims found", func(t *testing.T) {
token, err := idTokenExtractor(context.Background())
assert.Error(t, err)
assert.Empty(t, token)
})
t.Run("should return an empty token when grafana identity is set", func(t *testing.T) {
ctx, _ := identity.WithServiceIdentity(context.Background(), 0)
token, err := idTokenExtractor(ctx)
assert.NoError(t, err)
assert.Empty(t, token)
})
}