-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathprimaryHandler_test.go
More file actions
45 lines (37 loc) · 1.13 KB
/
primaryHandler_test.go
File metadata and controls
45 lines (37 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-FileCopyrightText: 2023 Comcast Cable Communications Management, LLC
// SPDX-License-Identifier: Apache-2.0
package main
import (
"testing"
"github.com/gorilla/mux"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
"github.com/xmidt-org/sallust"
"github.com/xmidt-org/touchstone"
"github.com/xmidt-org/webpa-common/v2/adapter"
// nolint:staticcheck
"github.com/xmidt-org/webpa-common/v2/xmetrics"
)
func TestNewPrimaryHandler(t *testing.T) {
var (
l = adapter.DefaultLogger().Logger
viper = viper.New()
sw = &ServerHandler{}
expectedAuthHeader = []string{"Basic xxxxxxx"}
)
require := require.New(t)
r, err := xmetrics.NewRegistry(nil)
require.NoError(err)
cfg := touchstone.Config{
DefaultNamespace: "n",
DefaultSubsystem: "s",
}
_, pr, err := touchstone.New(cfg)
require.NoError(err)
tf := touchstone.NewFactory(cfg, sallust.Default(), pr)
require.NotNil(tf)
viper.Set("authHeader", expectedAuthHeader)
if _, err := NewPrimaryHandler(l, viper, r, tf, sw, nil, mux.NewRouter(), true); err != nil {
t.Fatalf("NewPrimaryHandler failed: %v", err)
}
}