diff options
Diffstat (limited to 'store/sql_session_store_test.go')
-rw-r--r-- | store/sql_session_store_test.go | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/store/sql_session_store_test.go b/store/sql_session_store_test.go index 581aff971..3d8aafe25 100644 --- a/store/sql_session_store_test.go +++ b/store/sql_session_store_test.go @@ -80,7 +80,7 @@ func TestSessionRemove(t *testing.T) { } } -func TestSessionRemoveAlt(t *testing.T) { +func TestSessionRemoveAll(t *testing.T) { Setup() s1 := model.Session{} @@ -96,7 +96,30 @@ func TestSessionRemoveAlt(t *testing.T) { } } - Must(store.Session().Remove(s1.AltId)) + Must(store.Session().RemoveAllSessionsForTeam(s1.TeamId)) + + if rs2 := (<-store.Session().Get(s1.Id)); rs2.Err == nil { + t.Fatal("should have been removed") + } +} + +func TestSessionRemoveToken(t *testing.T) { + Setup() + + s1 := model.Session{} + s1.UserId = model.NewId() + s1.TeamId = model.NewId() + Must(store.Session().Save(&s1)) + + if rs1 := (<-store.Session().Get(s1.Id)); rs1.Err != nil { + t.Fatal(rs1.Err) + } else { + if rs1.Data.(*model.Session).Id != s1.Id { + t.Fatal("should match") + } + } + + Must(store.Session().Remove(s1.Token)) if rs2 := (<-store.Session().Get(s1.Id)); rs2.Err == nil { t.Fatal("should have been removed") |