From 9c36ca9aca013a749fc3f9df42394b77fcdeb027 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Tue, 15 Nov 2016 10:38:58 -0500 Subject: Deauthenticate websockets and set status to offline when user account deactivated (#4551) --- api/user_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'api/user_test.go') diff --git a/api/user_test.go b/api/user_test.go index f91d71177..0d67030d2 100644 --- a/api/user_test.go +++ b/api/user_test.go @@ -1133,8 +1133,9 @@ func TestUserUpdateDeviceId(t *testing.T) { } func TestUserUpdateActive(t *testing.T) { - th := Setup() + th := Setup().InitSystemAdmin() Client := th.CreateClient() + SystemAdminClient := th.SystemAdminClient team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN} team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team) @@ -1187,6 +1188,18 @@ func TestUserUpdateActive(t *testing.T) { if _, err := Client.UpdateActive("12345678901234567890123456", false); err == nil { t.Fatal("Should have errored, bad id") } + + SetStatusOnline(user3.Id, "", false) + + if _, err := SystemAdminClient.UpdateActive(user3.Id, false); err != nil { + t.Fatal(err) + } + + if status, err := GetStatus(user3.Id); err != nil { + t.Fatal(err) + } else if status.Status != model.STATUS_OFFLINE { + t.Fatal("status should have been set to offline") + } } func TestUserPermDelete(t *testing.T) { -- cgit v1.2.3-1-g7c22