2016-09-22 00:45:57 +00:00
|
|
|
package datastore
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-09-26 18:48:55 +00:00
|
|
|
"github.com/kolide/kolide-ose/server/kolide"
|
2016-09-22 00:45:57 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
2016-10-17 19:30:47 +00:00
|
|
|
func testOrgInfo(t *testing.T, ds kolide.Datastore) {
|
2016-09-22 00:45:57 +00:00
|
|
|
info := &kolide.OrgInfo{
|
|
|
|
OrgName: "Kolide",
|
|
|
|
OrgLogoURL: "localhost:8080/logo.png",
|
|
|
|
}
|
|
|
|
|
2016-10-17 19:30:47 +00:00
|
|
|
info, err := ds.NewOrgInfo(info)
|
2016-09-22 00:45:57 +00:00
|
|
|
assert.Nil(t, err)
|
|
|
|
|
2016-10-17 19:30:47 +00:00
|
|
|
info2, err := ds.OrgInfo()
|
2016-09-22 00:45:57 +00:00
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Equal(t, info2.OrgName, info.OrgName)
|
|
|
|
|
|
|
|
info2.OrgName = "koolide"
|
2016-10-17 19:30:47 +00:00
|
|
|
err = ds.SaveOrgInfo(info2)
|
2016-09-22 00:45:57 +00:00
|
|
|
assert.Nil(t, err)
|
|
|
|
|
2016-10-17 19:30:47 +00:00
|
|
|
info3, err := ds.OrgInfo()
|
2016-09-22 00:45:57 +00:00
|
|
|
assert.Nil(t, err)
|
|
|
|
assert.Equal(t, info3.OrgName, info2.OrgName)
|
|
|
|
|
2016-10-17 19:30:47 +00:00
|
|
|
info4, err := ds.NewOrgInfo(info3)
|
2016-09-22 00:45:57 +00:00
|
|
|
assert.Nil(t, err)
|
2016-10-17 19:30:47 +00:00
|
|
|
assert.Equal(t, info4.OrgName, info3.OrgName)
|
2016-09-22 00:45:57 +00:00
|
|
|
}
|