From 283f34b9c6d207f0a103e7b4c7f6da2c7481c3ef Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 20 Apr 2018 08:44:18 -0400 Subject: MM-10007 Send an admin and regular WS events when a user is updated (#8588) * Add user.DeepCopy() function * Add omit admins/non-admins to WS broadcast and use for updating users * Updates per feedback and adding unit test for ShouldSendEvent --- app/apptestlib.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/apptestlib.go') diff --git a/app/apptestlib.go b/app/apptestlib.go index 1b22831c9..a5c2db91c 100644 --- a/app/apptestlib.go +++ b/app/apptestlib.go @@ -31,6 +31,8 @@ type TestHelper struct { BasicChannel *model.Channel BasicPost *model.Post + SystemAdminUser *model.User + tempConfigPath string tempWorkspace string pluginHooks map[string]plugin.Hooks @@ -143,6 +145,14 @@ func (me *TestHelper) InitBasic() *TestHelper { return me } +func (me *TestHelper) InitSystemAdmin() *TestHelper { + me.SystemAdminUser = me.CreateUser() + me.App.UpdateUserRoles(me.SystemAdminUser.Id, model.SYSTEM_USER_ROLE_ID+" "+model.SYSTEM_ADMIN_ROLE_ID, false) + me.SystemAdminUser, _ = me.App.GetUser(me.SystemAdminUser.Id) + + return me +} + func (me *TestHelper) MakeEmail() string { return "success_" + model.NewId() + "@simulator.amazonses.com" } -- cgit v1.2.3-1-g7c22