diff --git a/tests/knocking_test.go b/tests/knocking_test.go index dca3500d..8fead174 100644 --- a/tests/knocking_test.go +++ b/tests/knocking_test.go @@ -10,20 +10,19 @@ package tests import ( "encoding/json" "fmt" + "net/http" "net/url" "testing" "time" - "net/http" - "github.com/matrix-org/complement" "github.com/matrix-org/gomatrixserverlib" "github.com/tidwall/gjson" "github.com/matrix-org/complement/b" "github.com/matrix-org/complement/client" - "github.com/matrix-org/complement/helpers" "github.com/matrix-org/complement/federation" + "github.com/matrix-org/complement/helpers" "github.com/matrix-org/complement/match" "github.com/matrix-org/complement/must" ) @@ -242,7 +241,13 @@ func knockingBetweenTwoUsersTest(t *testing.T, roomID string, inRoomUser, knocki })) }) + t.Run("A user cannot knock on a room they are already invited to", func(t *testing.T) { + reason := "I'm sticking my hand out the window and knocking again!" + knockOnRoomWithStatus(t, knockingUser, roomID, reason, []string{"hs1"}, 403) + }) + t.Run("A user cannot knock on a room they are already in", func(t *testing.T) { + knockingUser.MustJoinRoom(t, roomID, []string{"hs1"}) reason := "I'm sticking my hand out the window and knocking again!" knockOnRoomWithStatus(t, knockingUser, roomID, reason, []string{"hs1"}, 403) })