Skip to content

Commit

Permalink
Stabilize knock restricted tests (room v10). (#643)
Browse files Browse the repository at this point in the history
Use room version 10 instead of the unstable room version
(and remove references to the MSC since it is now part
of the spec).
  • Loading branch information
clokep authored Jul 13, 2023
1 parent 39436e9 commit 29ddb41
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions tests/msc3787_test.go → tests/knock_restricted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// +build msc3787

// This file contains tests for a join rule which mixes concepts of restricted joins
// and knocking. This is currently experimental and defined by MSC3787, found here:
// https://github.com/matrix-org/matrix-spec-proposals/pull/3787
// and knocking. This is implemented in room version 10.
//
// Generally, this is a combination of knocking_test and restricted_rooms_test.

Expand All @@ -16,26 +15,26 @@ import (
)

var (
msc3787RoomVersion = "org.matrix.msc3787"
msc3787JoinRule = "knock_restricted"
roomVersion = "10"
joinRule = "knock_restricted"
)

// See TestKnocking
func TestKnockingInMSC3787Room(t *testing.T) {
doTestKnocking(t, msc3787RoomVersion, msc3787JoinRule)
doTestKnocking(t, roomVersion, joinRule)
}

// See TestKnockRoomsInPublicRoomsDirectory
func TestKnockRoomsInPublicRoomsDirectoryInMSC3787Room(t *testing.T) {
doTestKnockRoomsInPublicRoomsDirectory(t, msc3787RoomVersion, msc3787JoinRule)
doTestKnockRoomsInPublicRoomsDirectory(t, roomVersion, joinRule)
}

// See TestCannotSendKnockViaSendKnock
func TestCannotSendKnockViaSendKnockInMSC3787Room(t *testing.T) {
testValidationForSendMembershipEndpoint(t, "/_matrix/federation/v1/send_knock", "knock",
map[string]interface{}{
"preset": "public_chat",
"room_version": msc3787RoomVersion,
"room_version": roomVersion,
},
)
}
Expand All @@ -46,13 +45,13 @@ func TestRestrictedRoomsLocalJoinInMSC3787Room(t *testing.T) {
defer deployment.Destroy(t)

// Setup the user, allowed room, and restricted room.
alice, allowed_room, room := setupRestrictedRoom(t, deployment, msc3787RoomVersion, msc3787JoinRule)
alice, allowed_room, room := setupRestrictedRoom(t, deployment, roomVersion, joinRule)

// Create a second user on the same homeserver.
bob := deployment.Client(t, "hs1", "@bob:hs1")

// Execute the checks.
checkRestrictedRoom(t, alice, bob, allowed_room, room, msc3787JoinRule)
checkRestrictedRoom(t, alice, bob, allowed_room, room, joinRule)
}

// See TestRestrictedRoomsRemoteJoin
Expand All @@ -61,21 +60,21 @@ func TestRestrictedRoomsRemoteJoinInMSC3787Room(t *testing.T) {
defer deployment.Destroy(t)

// Setup the user, allowed room, and restricted room.
alice, allowed_room, room := setupRestrictedRoom(t, deployment, msc3787RoomVersion, msc3787JoinRule)
alice, allowed_room, room := setupRestrictedRoom(t, deployment, roomVersion, joinRule)

// Create a second user on a different homeserver.
bob := deployment.Client(t, "hs2", "@bob:hs2")

// Execute the checks.
checkRestrictedRoom(t, alice, bob, allowed_room, room, msc3787JoinRule)
checkRestrictedRoom(t, alice, bob, allowed_room, room, joinRule)
}

// See TestRestrictedRoomsRemoteJoinLocalUser
func TestRestrictedRoomsRemoteJoinLocalUserInMSC3787Room(t *testing.T) {
doTestRestrictedRoomsRemoteJoinLocalUser(t, msc3787RoomVersion, msc3787JoinRule)
doTestRestrictedRoomsRemoteJoinLocalUser(t, roomVersion, joinRule)
}

// See TestRestrictedRoomsRemoteJoinFailOver
func TestRestrictedRoomsRemoteJoinFailOverInMSC3787Room(t *testing.T) {
doTestRestrictedRoomsRemoteJoinFailOver(t, msc3787RoomVersion, msc3787JoinRule)
doTestRestrictedRoomsRemoteJoinFailOver(t, roomVersion, joinRule)
}

0 comments on commit 29ddb41

Please sign in to comment.