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 --- model/utils_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'model/utils_test.go') diff --git a/model/utils_test.go b/model/utils_test.go index 92354c0a1..b7f5dc628 100644 --- a/model/utils_test.go +++ b/model/utils_test.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -47,6 +48,17 @@ func TestAppErrorJunk(t *testing.T) { } } +func TestCopyStringMap(t *testing.T) { + itemKey := "item1" + originalMap := make(map[string]string) + originalMap[itemKey] = "val1" + + copyMap := CopyStringMap(originalMap) + copyMap[itemKey] = "changed" + + assert.Equal(t, "val1", originalMap[itemKey]) +} + func TestMapJson(t *testing.T) { m := make(map[string]string) -- cgit v1.2.3-1-g7c22