Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/public-api-server/pkg/origin/context_test.go
2500 views
1
// Copyright (c) 2023 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 origin
6
7
import (
8
"context"
9
"testing"
10
11
"github.com/stretchr/testify/require"
12
)
13
14
func TestToFromContext(t *testing.T) {
15
require.Equal(t, "some-origin", FromContext(ToContext(context.Background(), "some-origin")), "origin stored on context is extracted")
16
require.Equal(t, "", FromContext(context.Background()), "context without origin value returns empty")
17
}
18
19