summaryrefslogtreecommitdiffstats
path: root/api4/user_test.go
diff options
context:
space:
mode:
authorMartin Kraft <martinkraft@gmail.com>2018-05-28 10:35:27 -0400
committerMartin Kraft <martinkraft@gmail.com>2018-05-28 10:35:27 -0400
commitc180cdbd1cba584c6e74cae7042de2290b51feb6 (patch)
tree19002d12a212d0bcc0e09d31410df548b93d77ef /api4/user_test.go
parent7225abddeefb569f1f2da739211d7797b63814a2 (diff)
parentc37d153ffb276e501660133de836a61eec25e544 (diff)
downloadchat-c180cdbd1cba584c6e74cae7042de2290b51feb6.tar.gz
chat-c180cdbd1cba584c6e74cae7042de2290b51feb6.tar.bz2
chat-c180cdbd1cba584c6e74cae7042de2290b51feb6.zip
Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Diffstat (limited to 'api4/user_test.go')
-rw-r--r--api4/user_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/api4/user_test.go b/api4/user_test.go
index 4851f139e..593208c92 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -1198,6 +1198,12 @@ func TestUpdateUserActive(t *testing.T) {
SystemAdminClient := th.SystemAdminClient
user := th.BasicUser
+ EnableUserDeactivation := th.App.Config().TeamSettings.EnableUserDeactivation
+ defer func() {
+ th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserDeactivation = EnableUserDeactivation })
+ }()
+
+ th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserDeactivation = true })
pass, resp := Client.UpdateUserActive(user.Id, false)
CheckNoError(t, resp)
@@ -1205,6 +1211,15 @@ func TestUpdateUserActive(t *testing.T) {
t.Fatal("should have returned true")
}
+ th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserDeactivation = false })
+ pass, resp = Client.UpdateUserActive(user.Id, false)
+ CheckUnauthorizedStatus(t, resp)
+
+ if pass {
+ t.Fatal("should have returned false")
+ }
+
+ th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserDeactivation = true })
pass, resp = Client.UpdateUserActive(user.Id, false)
CheckUnauthorizedStatus(t, resp)