Skip to content

Commit

Permalink
Add a test for invite->knock transitions (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
S7evinK authored Jan 16, 2024
1 parent 3332726 commit ee9130f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/knocking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
})
Expand Down

0 comments on commit ee9130f

Please sign in to comment.