summaryrefslogtreecommitdiffstats
path: root/api4/user_test.go
diff options
context:
space:
mode:
authorChris Duarte <csduarte@users.noreply.github.com>2017-11-28 11:46:48 -0800
committerChristopher Speller <crspeller@gmail.com>2017-11-28 11:46:48 -0800
commit27ba68a7894d5204b8d75dc7353774977d62fa15 (patch)
tree28af6c0900a1967ee8145575daca57c76f781d79 /api4/user_test.go
parent785a410936daff5db7fba07dc5735bd74dd158bb (diff)
downloadchat-27ba68a7894d5204b8d75dc7353774977d62fa15.tar.gz
chat-27ba68a7894d5204b8d75dc7353774977d62fa15.tar.bz2
chat-27ba68a7894d5204b8d75dc7353774977d62fa15.zip
Add Config to disable Auth Transfers. (#7843)
* Add Config to disable Auth Transfers. * Set config ExperimentalEnableAuthenticationTransfer behind an E20 license restriction
Diffstat (limited to 'api4/user_test.go')
-rw-r--r--api4/user_test.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/api4/user_test.go b/api4/user_test.go
index 0c2b86eda..9c554da54 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -2117,6 +2117,57 @@ 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.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = false })
+
+ sr = &model.SwitchRequest{
+ CurrentService: model.USER_AUTH_SERVICE_EMAIL,
+ NewService: model.USER_AUTH_SERVICE_GITLAB,
+ }
+
+ _, resp = Client.SwitchAccountType(sr)
+ CheckForbiddenStatus(t, resp)
+
+ th.LoginBasic()
+
+ sr = &model.SwitchRequest{
+ CurrentService: model.USER_AUTH_SERVICE_SAML,
+ NewService: model.USER_AUTH_SERVICE_EMAIL,
+ Email: th.BasicUser.Email,
+ NewPassword: th.BasicUser.Password,
+ }
+
+ _, resp = Client.SwitchAccountType(sr)
+ CheckForbiddenStatus(t, resp)
+
+ sr = &model.SwitchRequest{
+ CurrentService: model.USER_AUTH_SERVICE_EMAIL,
+ NewService: model.USER_AUTH_SERVICE_LDAP,
+ }
+
+ _, resp = Client.SwitchAccountType(sr)
+ CheckForbiddenStatus(t, resp)
+
+ sr = &model.SwitchRequest{
+ CurrentService: model.USER_AUTH_SERVICE_LDAP,
+ NewService: model.USER_AUTH_SERVICE_EMAIL,
+ }
+
+ _, resp = Client.SwitchAccountType(sr)
+ CheckForbiddenStatus(t, resp)
+
+ th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = true })
+
th.LoginBasic()
fakeAuthData := model.NewId()