From 03c6dcbd865e2af2db5db150189504bfa493ae2e Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sun, 15 Nov 2015 18:18:02 -0800 Subject: PLT-975 adding perm deletes --- store/sql_session_store_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'store/sql_session_store_test.go') diff --git a/store/sql_session_store_test.go b/store/sql_session_store_test.go index 068e5fc19..a06a2bdff 100644 --- a/store/sql_session_store_test.go +++ b/store/sql_session_store_test.go @@ -103,6 +103,29 @@ func TestSessionRemoveAll(t *testing.T) { } } +func TestSessionRemoveByUser(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().RemoveAllSessionsForUser(s1.UserId)) + + if rs2 := (<-store.Session().Get(s1.Id)); rs2.Err == nil { + t.Fatal("should have been removed") + } +} + func TestSessionRemoveToken(t *testing.T) { Setup() -- cgit v1.2.3-1-g7c22 From 6b2eabf6108e078bed8143e91c605dec5ccfafa6 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 16 Nov 2015 17:12:49 -0800 Subject: Adding perm delete to cmd line --- store/sql_session_store_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'store/sql_session_store_test.go') diff --git a/store/sql_session_store_test.go b/store/sql_session_store_test.go index a06a2bdff..cec8e93b0 100644 --- a/store/sql_session_store_test.go +++ b/store/sql_session_store_test.go @@ -119,7 +119,7 @@ func TestSessionRemoveByUser(t *testing.T) { } } - Must(store.Session().RemoveAllSessionsForUser(s1.UserId)) + Must(store.Session().PermanentDeleteSessionsByUser(s1.UserId)) if rs2 := (<-store.Session().Get(s1.Id)); rs2.Err == nil { t.Fatal("should have been removed") -- cgit v1.2.3-1-g7c22