summaryrefslogtreecommitdiffstats
path: root/app/session_test.go
diff options
context:
space:
mode:
authorJonathan Fritz <jonathan.fritz@mattermost.com>2018-02-13 08:39:56 -0500
committerJonathan Fritz <jonathan.fritz@mattermost.com>2018-02-13 08:39:56 -0500
commit18fa32567b56584c6e24da2ae68814d5bf8ece6f (patch)
tree311ab6a3918ba64ac665286f15950b32dc1b1dba /app/session_test.go
parent7b2861de3a09cf00d00b0872cc537d54302c4bfa (diff)
parent8b79f5d49cb8d4877e136a76e515edef41ef6f28 (diff)
downloadchat-18fa32567b56584c6e24da2ae68814d5bf8ece6f.tar.gz
chat-18fa32567b56584c6e24da2ae68814d5bf8ece6f.tar.bz2
chat-18fa32567b56584c6e24da2ae68814d5bf8ece6f.zip
Merge branch 'release-4.7' into XYZ-110
Diffstat (limited to 'app/session_test.go')
-rw-r--r--app/session_test.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/app/session_test.go b/app/session_test.go
index bf8198a4e..bca3b59b7 100644
--- a/app/session_test.go
+++ b/app/session_test.go
@@ -6,10 +6,11 @@ package app
import (
"testing"
+ "github.com/mattermost/mattermost-server/model"
+ "github.com/mattermost/mattermost-server/utils"
+
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
-
- "github.com/mattermost/mattermost-server/model"
)
func TestCache(t *testing.T) {
@@ -47,7 +48,18 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
session, _ = th.App.CreateSession(session)
- th.App.SetLicense(model.NewTestLicense("compliance"))
+ isLicensed := utils.IsLicensed()
+ license := utils.License()
+ timeout := *th.App.Config().ServiceSettings.SessionIdleTimeoutInMinutes
+ defer func() {
+ utils.SetIsLicensed(isLicensed)
+ utils.SetLicense(license)
+ th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SessionIdleTimeoutInMinutes = timeout })
+ }()
+ utils.SetIsLicensed(true)
+ utils.SetLicense(&model.License{Features: &model.Features{}})
+ utils.License().Features.SetDefaults()
+ *utils.License().Features.Compliance = true
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SessionIdleTimeoutInMinutes = 5 })
rsession, err := th.App.GetSession(session.Token)
@@ -110,7 +122,7 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
assert.Nil(t, err)
// Test regular session with license off, should not timeout
- th.App.SetLicense(nil)
+ *utils.License().Features.Compliance = false
session = &model.Session{
UserId: model.NewId(),
@@ -124,7 +136,7 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
_, err = th.App.GetSession(session.Token)
assert.Nil(t, err)
- th.App.SetLicense(model.NewTestLicense("compliance"))
+ *utils.License().Features.Compliance = true
// Test regular session with timeout set to 0, should not timeout
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SessionIdleTimeoutInMinutes = 0 })