summaryrefslogtreecommitdiffstats
path: root/app/session_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/session_test.go')
-rw-r--r--app/session_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/app/session_test.go b/app/session_test.go
new file mode 100644
index 000000000..352395c76
--- /dev/null
+++ b/app/session_test.go
@@ -0,0 +1,31 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package app
+
+import (
+ "github.com/mattermost/platform/model"
+ "testing"
+)
+
+func TestCache(t *testing.T) {
+ session := &model.Session{
+ Id: model.NewId(),
+ Token: model.NewId(),
+ UserId: model.NewId(),
+ }
+
+ sessionCache.AddWithExpiresInSecs(session.Token, session, 5*60)
+
+ keys := sessionCache.Keys()
+ if len(keys) <= 0 {
+ t.Fatal("should have items")
+ }
+
+ RemoveAllSessionsForUserId(session.UserId)
+
+ rkeys := sessionCache.Keys()
+ if len(rkeys) != len(keys)-1 {
+ t.Fatal("should have one less")
+ }
+}