We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e2179d9 commit 9ff7a33Copy full SHA for 9ff7a33
components/public-api-server/pkg/auth/context_test.go
@@ -0,0 +1,23 @@
1
+// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
+// Licensed under the GNU Affero General Public License (AGPL).
3
+// See License-AGPL.txt in the project root for license information.
4
+
5
+package auth
6
7
+import (
8
+ "context"
9
+ "testing"
10
11
+ "github.com/stretchr/testify/require"
12
+)
13
14
+func TestTokenToAndFromContext(t *testing.T) {
15
+ token := "my_token"
16
17
+ extracted := TokenFromContext(TokenToContext(context.Background(), token))
18
+ require.Equal(t, token, extracted)
19
+}
20
21
+func TestTokenFromContext_EmptyWhenNotSet(t *testing.T) {
22
+ require.Equal(t, "", TokenFromContext(context.Background()))
23
0 commit comments