diff options
author | Corey Hulen <corey@hulen.com> | 2016-03-02 12:22:11 -0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-03-02 12:22:11 -0800 |
commit | c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7 (patch) | |
tree | 822f5614a031f8d65c3ddca7e3e3dfec1152e053 /store/sql_session_store_test.go | |
parent | cddc9df7c4371e4240d65c6874155e1ce85adff0 (diff) | |
parent | fbb71cab4b4c0289c1f071f9fa2e61b0b0237ece (diff) | |
download | chat-c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7.tar.gz chat-c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7.tar.bz2 chat-c52153bf601cee5bc21e9e79efcd1fdd5ef1dac7.zip |
Merge pull request #2258 from mattermost/plt-1796
PLT-1796 Refactor and modularize analytics on the client
Diffstat (limited to 'store/sql_session_store_test.go')
-rw-r--r-- | store/sql_session_store_test.go | 26 |
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") + } + } +} |