2022-02-03 18:35:54 +01:00
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
2022-05-25 23:25:02 +02:00
|
|
|
"context"
|
2022-02-03 18:35:54 +01:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2022-05-25 23:25:02 +02:00
|
|
|
"google.golang.org/grpc/metadata"
|
2022-02-03 18:35:54 +01:00
|
|
|
)
|
|
|
|
|
2022-05-25 23:25:02 +02:00
|
|
|
func Test_LocalWTVersion(t *testing.T) {
|
|
|
|
got := GetInfo(context.TODO())
|
2022-02-03 18:35:54 +01:00
|
|
|
want := "development"
|
|
|
|
assert.Equal(t, want, got.WiretrusteeVersion)
|
|
|
|
}
|
2022-05-25 23:25:02 +02:00
|
|
|
|
|
|
|
func Test_UIVersion(t *testing.T) {
|
|
|
|
ctx := context.Background()
|
|
|
|
want := "netbird-desktop-ui/development"
|
|
|
|
ctx = metadata.NewOutgoingContext(ctx, map[string][]string{
|
|
|
|
"user-agent": {want},
|
|
|
|
})
|
|
|
|
|
|
|
|
got := GetInfo(ctx)
|
|
|
|
assert.Equal(t, want, got.UIVersion)
|
|
|
|
}
|
2023-04-20 16:00:22 +02:00
|
|
|
|
|
|
|
func Test_CustomHostname(t *testing.T) {
|
|
|
|
// nolint
|
|
|
|
ctx := context.WithValue(context.Background(), DeviceNameCtxKey, "custom-host")
|
|
|
|
want := "custom-host"
|
|
|
|
|
|
|
|
got := GetInfo(ctx)
|
|
|
|
assert.Equal(t, want, got.Hostname)
|
|
|
|
}
|