mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-12 01:40:40 +01:00
c2e90a2a97
Configure via --hostname (or -n) flag in the `up` and `login` commands --------- Signed-off-by: Chinmay D. Pai <chinmay.pai@zerodha.com>
36 lines
746 B
Go
36 lines
746 B
Go
package system
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"google.golang.org/grpc/metadata"
|
|
)
|
|
|
|
func Test_LocalWTVersion(t *testing.T) {
|
|
got := GetInfo(context.TODO())
|
|
want := "development"
|
|
assert.Equal(t, want, got.WiretrusteeVersion)
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
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)
|
|
}
|