mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* format using `goimports -local github.com/mattermost/mattermost-server/v5 -w` * added goimports lint check to .golangci.yml * format using `goimports -local github.com/mattermost/mattermost-server/v5 -w` for a corner case * make app-layers, *-mocks and store-layers for ci check Co-authored-by: Mahmudul Haque <mahmudulhaque@protonmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
40 lines
892 B
Go
40 lines
892 B
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package app
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/mattermost/mattermost-server/v5/model"
|
|
)
|
|
|
|
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)
|
|
})
|
|
}
|
|
}
|