summaryrefslogtreecommitdiffstats
path: root/app/status_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/status_test.go')
-rw-r--r--app/status_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/app/status_test.go b/app/status_test.go
new file mode 100644
index 000000000..bf5736a48
--- /dev/null
+++ b/app/status_test.go
@@ -0,0 +1,40 @@
+// 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"
+)
+
+func TestSaveStatus(t *testing.T) {
+ th := Setup().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)
+ if err != nil {
+ t.Fatalf("failed to get status after save: %v", err)
+ } else if after.Status != statusString {
+ t.Fatalf("failed to save status, got %v, expected %v", after.Status, statusString)
+ }
+ })
+ }
+}