Files
mattermost/app/status_test.go
Hector c02b489302 Mm 19006 (#12616)
* Refactor to use structured logging

* Properly formatted with gofmt

* migrate tests to use testify

* fix: swap expected and actual
2019-10-09 15:43:13 -04:00

39 lines
888 B
Go

// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package app
import (
"testing"
"github.com/mattermost/mattermost-server/model"
"github.com/stretchr/testify/require"
)
func TestSaveStatus(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
user := th.BasicUser
for _, statusString := range []string{
model.STATUS_ONLINE,
model.STATUS_AWAY,
model.STATUS_DND,
model.STATUS_OFFLINE,
} {
t.Run(statusString, func(t *testing.T) {
status := &model.Status{
UserId: user.Id,
Status: statusString,
}
th.App.SaveAndBroadcastStatus(status)
after, err := th.App.GetStatus(user.Id)
require.Nil(t, err, "failed to get status after save: %v", err)
require.Equal(t, statusString, after.Status, "failed to save status, got %v, expected %v", after.Status, statusString)
})
}
}