mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 17:28:54 +00:00
bde7256a09
- Remove unnecessary labels code - Remove unnecessary packs code - Update tests as appropriate
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package datastore
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/kolide/fleet/server/kolide"
|
|
"github.com/kolide/fleet/server/test"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func testUnicode(t *testing.T, ds kolide.Datastore) {
|
|
if ds.Name() == "inmem" {
|
|
t.Skip("inmem is being deprecated, test skipped")
|
|
}
|
|
|
|
l1 := kolide.LabelSpec{
|
|
ID: 1,
|
|
Name: "測試",
|
|
Query: "query foo",
|
|
}
|
|
err := ds.ApplyLabelSpecs([]*kolide.LabelSpec{&l1})
|
|
require.Nil(t, err)
|
|
|
|
label, err := ds.Label(l1.ID)
|
|
require.Nil(t, err)
|
|
assert.Equal(t, "測試", label.Name)
|
|
|
|
host, err := ds.NewHost(&kolide.Host{
|
|
HostName: "🍌",
|
|
DetailUpdateTime: time.Now(),
|
|
SeenTime: time.Now(),
|
|
})
|
|
require.Nil(t, err)
|
|
|
|
host, err = ds.Host(host.ID)
|
|
assert.Equal(t, "🍌", host.HostName)
|
|
|
|
user, err := ds.NewUser(&kolide.User{Username: "🍱", Password: []byte{}})
|
|
require.Nil(t, err)
|
|
|
|
user, err = ds.User(user.Username)
|
|
require.Nil(t, err)
|
|
assert.Equal(t, "🍱", user.Username)
|
|
|
|
pack := test.NewPack(t, ds, "👨🏾🚒")
|
|
|
|
pack, err = ds.Pack(pack.ID)
|
|
assert.Equal(t, "👨🏾🚒", pack.Name)
|
|
}
|