Skip to content

Commit 9ff7a33

Browse files
committed
fix
1 parent e2179d9 commit 9ff7a33

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)