mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
33 lines
805 B
Go
33 lines
805 B
Go
|
|
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
||
|
|
// See License.txt for license information.
|
||
|
|
|
||
|
|
package app
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"github.com/stretchr/testify/assert"
|
||
|
|
"github.com/stretchr/testify/require"
|
||
|
|
|
||
|
|
"github.com/mattermost/mattermost-server/model"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestPluginAPIUpdateUserStatus(t *testing.T) {
|
||
|
|
th := Setup().InitBasic()
|
||
|
|
defer th.TearDown()
|
||
|
|
api := th.SetupPluginAPI()
|
||
|
|
|
||
|
|
statuses := []string{model.STATUS_ONLINE, model.STATUS_AWAY, model.STATUS_DND, model.STATUS_OFFLINE}
|
||
|
|
|
||
|
|
for _, s := range statuses {
|
||
|
|
status, err := api.UpdateUserStatus(th.BasicUser.Id, s)
|
||
|
|
require.Nil(t, err)
|
||
|
|
require.NotNil(t, status)
|
||
|
|
assert.Equal(t, s, status.Status)
|
||
|
|
}
|
||
|
|
|
||
|
|
status, err := api.UpdateUserStatus(th.BasicUser.Id, "notrealstatus")
|
||
|
|
assert.NotNil(t, err)
|
||
|
|
assert.Nil(t, status)
|
||
|
|
}
|