From c3e9c414408a8c9c2806af12e659e395c605496f Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Mon, 28 May 2018 16:20:08 +0200 Subject: [MM-1915] Add Deactivate Account - server side (#8699) --- api4/user_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'api4/user_test.go') 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) -- cgit v1.2.3-1-g7c22