summaryrefslogtreecommitdiffstats
path: root/store/sql_session_store_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/sql_session_store_test.go')
-rw-r--r--store/sql_session_store_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/store/sql_session_store_test.go b/store/sql_session_store_test.go
index 34d3128a6..506695f0e 100644
--- a/store/sql_session_store_test.go
+++ b/store/sql_session_store_test.go
@@ -200,3 +200,29 @@ func TestSessionStoreUpdateLastActivityAt(t *testing.T) {
}
}
+
+func TestSessionCount(t *testing.T) {
+ Setup()
+
+ s1 := model.Session{}
+ s1.UserId = model.NewId()
+ s1.TeamId = model.NewId()
+ s1.ExpiresAt = model.GetMillis() + 100000
+ Must(store.Session().Save(&s1))
+
+ if r1 := <-store.Session().AnalyticsSessionCount(""); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ if r1.Data.(int64) == 0 {
+ t.Fatal("should have at least 1 session")
+ }
+ }
+
+ if r2 := <-store.Session().AnalyticsSessionCount(s1.TeamId); r2.Err != nil {
+ t.Fatal(r2.Err)
+ } else {
+ if r2.Data.(int64) != 1 {
+ t.Fatal("should have 1 session")
+ }
+ }
+}