summaryrefslogtreecommitdiffstats
path: root/api/user_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-11-15 10:38:58 -0500
committerenahum <nahumhbl@gmail.com>2016-11-15 12:38:58 -0300
commit9c36ca9aca013a749fc3f9df42394b77fcdeb027 (patch)
treed5426077a6bff5840ca07642124fe2c76ac1992f /api/user_test.go
parent526c392aad1f486dddb7cc411244f4446cb06a3a (diff)
downloadchat-9c36ca9aca013a749fc3f9df42394b77fcdeb027.tar.gz
chat-9c36ca9aca013a749fc3f9df42394b77fcdeb027.tar.bz2
chat-9c36ca9aca013a749fc3f9df42394b77fcdeb027.zip
Deauthenticate websockets and set status to offline when user account deactivated (#4551)
Diffstat (limited to 'api/user_test.go')
-rw-r--r--api/user_test.go15
1 files changed, 14 insertions, 1 deletions
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) {