mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* PLT-5860 Updated copyright date in about modal * PLT-5860 Updated copyright notice in JSX files * PLT-5860 Updated copyright notice in go files * Fixed misc copyright dates * Fixed component snapshots
57 lines
1.1 KiB
Go
57 lines
1.1 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package store
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mattermost/platform/model"
|
|
)
|
|
|
|
func TestSqlSystemStore(t *testing.T) {
|
|
Setup()
|
|
|
|
system := &model.System{Name: model.NewId(), Value: "value"}
|
|
Must(store.System().Save(system))
|
|
|
|
result := <-store.System().Get()
|
|
systems := result.Data.(model.StringMap)
|
|
|
|
if systems[system.Name] != system.Value {
|
|
t.Fatal()
|
|
}
|
|
|
|
system.Value = "value2"
|
|
Must(store.System().Update(system))
|
|
|
|
result2 := <-store.System().Get()
|
|
systems2 := result2.Data.(model.StringMap)
|
|
|
|
if systems2[system.Name] != system.Value {
|
|
t.Fatal()
|
|
}
|
|
|
|
result3 := <-store.System().GetByName(system.Name)
|
|
rsystem := result3.Data.(*model.System)
|
|
if rsystem.Value != system.Value {
|
|
t.Fatal()
|
|
}
|
|
}
|
|
|
|
func TestSqlSystemStoreSaveOrUpdate(t *testing.T) {
|
|
Setup()
|
|
|
|
system := &model.System{Name: model.NewId(), Value: "value"}
|
|
|
|
if err := (<-store.System().SaveOrUpdate(system)).Err; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
system.Value = "value2"
|
|
|
|
if r := <-store.System().SaveOrUpdate(system); r.Err != nil {
|
|
t.Fatal(r.Err)
|
|
}
|
|
}
|