summaryrefslogtreecommitdiffstats
path: root/api4/user_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2018-02-12 12:02:54 -0600
committerGitHub <noreply@github.com>2018-02-12 12:02:54 -0600
commit1ae680aefae2deb1e9d07d7c2a1c863ec807a79f (patch)
treea99a74d6b858d73624c06f85e393acbe97c90586 /api4/user_test.go
parent9707ac3aaf2cb4352c573aadf54b8535e237dd9e (diff)
parent07fd7aeeb8eb2b198b01b713a4ab57f6352faef2 (diff)
downloadchat-1ae680aefae2deb1e9d07d7c2a1c863ec807a79f.tar.gz
chat-1ae680aefae2deb1e9d07d7c2a1c863ec807a79f.tar.bz2
chat-1ae680aefae2deb1e9d07d7c2a1c863ec807a79f.zip
Merge branch 'master' into release-4.7
Diffstat (limited to 'api4/user_test.go')
-rw-r--r--api4/user_test.go53
1 files changed, 4 insertions, 49 deletions
diff --git a/api4/user_test.go b/api4/user_test.go
index a7b7d297d..4613a8ea9 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -1566,18 +1566,7 @@ func TestUpdateUserMfa(t *testing.T) {
defer th.TearDown()
Client := th.Client
- isLicensed := utils.IsLicensed()
- license := utils.License()
- enableMfa := *th.App.Config().ServiceSettings.EnableMultifactorAuthentication
- defer func() {
- utils.SetIsLicensed(isLicensed)
- utils.SetLicense(license)
- th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = enableMfa })
- }()
- utils.SetIsLicensed(true)
- utils.SetLicense(&model.License{Features: &model.Features{}})
- utils.License().Features.SetDefaults()
- *utils.License().Features.MFA = true
+ th.App.SetLicense(model.NewTestLicense("mfa"))
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
session, _ := th.App.GetSession(Client.AuthToken)
@@ -1612,18 +1601,7 @@ func TestCheckUserMfa(t *testing.T) {
t.Fatal("should be false - mfa not active")
}
- isLicensed := utils.IsLicensed()
- license := utils.License()
- enableMfa := *th.App.Config().ServiceSettings.EnableMultifactorAuthentication
- defer func() {
- utils.SetIsLicensed(isLicensed)
- utils.SetLicense(license)
- th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = enableMfa })
- }()
- utils.SetIsLicensed(true)
- utils.SetLicense(&model.License{Features: &model.Features{}})
- utils.License().Features.SetDefaults()
- *utils.License().Features.MFA = true
+ th.App.SetLicense(model.NewTestLicense("mfa"))
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
th.LoginBasic()
@@ -1659,18 +1637,7 @@ func TestGenerateMfaSecret(t *testing.T) {
_, resp = Client.GenerateMfaSecret("junk")
CheckBadRequestStatus(t, resp)
- isLicensed := utils.IsLicensed()
- license := utils.License()
- enableMfa := *th.App.Config().ServiceSettings.EnableMultifactorAuthentication
- defer func() {
- utils.SetIsLicensed(isLicensed)
- utils.SetLicense(license)
- th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = enableMfa })
- }()
- utils.SetIsLicensed(true)
- utils.SetLicense(&model.License{Features: &model.Features{}})
- utils.License().Features.SetDefaults()
- *utils.License().Features.MFA = true
+ th.App.SetLicense(model.NewTestLicense("mfa"))
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
_, resp = Client.GenerateMfaSecret(model.NewId())
@@ -2187,19 +2154,7 @@ func TestSwitchAccount(t *testing.T) {
t.Fatal("bad link")
}
- isLicensed := utils.IsLicensed()
- license := utils.License()
- enableAuthenticationTransfer := *th.App.Config().ServiceSettings.ExperimentalEnableAuthenticationTransfer
- defer func() {
- utils.SetIsLicensed(isLicensed)
- utils.SetLicense(license)
- th.App.UpdateConfig(func(cfg *model.Config) {
- *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = enableAuthenticationTransfer
- })
- }()
- utils.SetIsLicensed(true)
- utils.SetLicense(&model.License{Features: &model.Features{}})
- utils.License().Features.SetDefaults()
+ th.App.SetLicense(model.NewTestLicense())
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = false })
sr = &model.SwitchRequest{