From 5c84714d1fc33803dc135c3813278168df2a6157 Mon Sep 17 00:00:00 2001 From: nxshock Date: Wed, 31 Jul 2019 20:10:16 +0500 Subject: [PATCH] Add test case for changing room visibility --- internal/backends/memory/user_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/backends/memory/user_test.go b/internal/backends/memory/user_test.go index 992dd64..a3d3507 100644 --- a/internal/backends/memory/user_test.go +++ b/internal/backends/memory/user_test.go @@ -163,4 +163,12 @@ func TestSetRoomVisibility(t *testing.T) { err = user.SetRoomVisibility(room, createroom.VisibilityTypePublic) assert.Nil(t, err) assert.Equal(t, createroom.VisibilityTypePublic, room.Visibility()) + + // TODO: Only owner can change room visibility + notOwnerUser, _, err := backend.Register("user2", "", "") + assert.Nil(t, err) + + err = notOwnerUser.SetRoomVisibility(room, createroom.VisibilityTypePrivate) + assert.NotNil(t, err) + assert.NotEqual(t, createroom.VisibilityTypePrivate, room.Visibility()) }