Debian Codegraph @

extension/extensionauth/server_test.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package extensionauth
5
6 import (
7 "context"
8 "testing"
9
10 "github.com/stretchr/testify/assert"
11 "github.com/stretchr/testify/require"
12 )
13
14 func TestServerAuthenticateFunc(t *testing.T) {
15 var called bool
16 var server Server = ServerAuthenticateFunc(func(ctx context.Context, _ map[string][]string) (context.Context, error) {
17 called = true
18 return ctx, nil
19 })
20
21 ctx, err := server.Authenticate(context.Background(), nil)
22 require.NoError(t, err)
23 assert.True(t, called)
24 assert.NotNil(t, ctx)
25 }