summaryrefslogtreecommitdiffstats
path: root/app/plugin_api_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-07-16 15:49:26 -0400
committerGitHub <noreply@github.com>2018-07-16 15:49:26 -0400
commit275731578e72d2c6e12cfb2fc315d3446474faec (patch)
tree25df7525ed2244c7dec5be44495b45ffc0ae1023 /app/plugin_api_test.go
parent88eef609ab712097ff2b13a2ca45c31ea6fa7df2 (diff)
downloadchat-275731578e72d2c6e12cfb2fc315d3446474faec.tar.gz
chat-275731578e72d2c6e12cfb2fc315d3446474faec.tar.bz2
chat-275731578e72d2c6e12cfb2fc315d3446474faec.zip
MM-10254 Add plugin APIs for getting/updating user statuses (#9101)
* Add plugin APIs for getting/updating user statuses * Add and update tests * Updates per feedback
Diffstat (limited to 'app/plugin_api_test.go')
-rw-r--r--app/plugin_api_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/plugin_api_test.go b/app/plugin_api_test.go
new file mode 100644
index 000000000..56507a8f7
--- /dev/null
+++ b/app/plugin_api_test.go
@@ -0,0 +1,32 @@
+// 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)
+}