summaryrefslogtreecommitdiffstats
path: root/app/session_test.go
diff options
context:
space:
mode:
authorDerrick Anderson <derrick@andersonwebstudio.com>2018-02-12 15:09:59 -0500
committerDerrick Anderson <derrick@andersonwebstudio.com>2018-02-12 15:09:59 -0500
commitefd620d6c80ddc1f015811ec58514e34ee0b501b (patch)
tree8fdcc1043aba1c9a66382b915f4e185ade1128fb /app/session_test.go
parent87fb19b8279c86c72ffec623e55b80ce35b7d64f (diff)
parent1ae680aefae2deb1e9d07d7c2a1c863ec807a79f (diff)
downloadchat-efd620d6c80ddc1f015811ec58514e34ee0b501b.tar.gz
chat-efd620d6c80ddc1f015811ec58514e34ee0b501b.tar.bz2
chat-efd620d6c80ddc1f015811ec58514e34ee0b501b.zip
Merge branch 'release-4.7' into icu669
Diffstat (limited to 'app/session_test.go')
-rw-r--r--app/session_test.go22
1 files changed, 5 insertions, 17 deletions
diff --git a/app/session_test.go b/app/session_test.go
index bca3b59b7..bf8198a4e 100644
--- a/app/session_test.go
+++ b/app/session_test.go
@@ -6,11 +6,10 @@ 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) {
@@ -48,18 +47,7 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
session, _ = th.App.CreateSession(session)
- 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.SetLicense(model.NewTestLicense("compliance"))
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SessionIdleTimeoutInMinutes = 5 })
rsession, err := th.App.GetSession(session.Token)
@@ -122,7 +110,7 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
assert.Nil(t, err)
// Test regular session with license off, should not timeout
- *utils.License().Features.Compliance = false
+ th.App.SetLicense(nil)
session = &model.Session{
UserId: model.NewId(),
@@ -136,7 +124,7 @@ func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
_, err = th.App.GetSession(session.Token)
assert.Nil(t, err)
- *utils.License().Features.Compliance = true
+ th.App.SetLicense(model.NewTestLicense("compliance"))
// Test regular session with timeout set to 0, should not timeout
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SessionIdleTimeoutInMinutes = 0 })