Skip to content

Commit ee9130f

Browse files
authored
Add a test for invite->knock transitions (#702)
1 parent 3332726 commit ee9130f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/knocking_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ package tests
1010
import (
1111
"encoding/json"
1212
"fmt"
13+
"net/http"
1314
"net/url"
1415
"testing"
1516
"time"
1617

17-
"net/http"
18-
1918
"github.com/matrix-org/complement"
2019
"github.com/matrix-org/gomatrixserverlib"
2120
"github.com/tidwall/gjson"
2221

2322
"github.com/matrix-org/complement/b"
2423
"github.com/matrix-org/complement/client"
25-
"github.com/matrix-org/complement/helpers"
2624
"github.com/matrix-org/complement/federation"
25+
"github.com/matrix-org/complement/helpers"
2726
"github.com/matrix-org/complement/match"
2827
"github.com/matrix-org/complement/must"
2928
)
@@ -242,7 +241,13 @@ func knockingBetweenTwoUsersTest(t *testing.T, roomID string, inRoomUser, knocki
242241
}))
243242
})
244243

244+
t.Run("A user cannot knock on a room they are already invited to", func(t *testing.T) {
245+
reason := "I'm sticking my hand out the window and knocking again!"
246+
knockOnRoomWithStatus(t, knockingUser, roomID, reason, []string{"hs1"}, 403)
247+
})
248+
245249
t.Run("A user cannot knock on a room they are already in", func(t *testing.T) {
250+
knockingUser.MustJoinRoom(t, roomID, []string{"hs1"})
246251
reason := "I'm sticking my hand out the window and knocking again!"
247252
knockOnRoomWithStatus(t, knockingUser, roomID, reason, []string{"hs1"}, 403)
248253
})

0 commit comments

Comments
 (0)