Add check to confirm that state preset is effectively private when present and visibility are unset

This commit is contained in:
Tristian Celestin 2025-03-23 10:00:47 -04:00
parent f9745381e5
commit 2849080417

View file

@ -2330,8 +2330,23 @@ func TestCreateRoomInvite(t *testing.T) {
roomID := gjson.GetBytes(w.Body.Bytes(), "room_id").Str
validRoomID, _ := spec.NewRoomID(roomID)
// Confirm that the room matches the private state preset
ev, err := rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomJoinRules, spec.Invite)
if err != nil {
t.Fatal(err)
}
ev, err = rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomHistoryVisibility, string(gomatrixserverlib.HistoryVisibilityShared))
if err != nil {
t.Fatal(err)
}
ev, err = rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomGuestAccess, "can_join")
if err != nil {
t.Fatal(err)
}
// Now ask the roomserver about the membership event of Bob
ev, err := rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomMember, bob.ID)
ev, err = rsAPI.CurrentStateEvent(context.Background(), *validRoomID, spec.MRoomMember, bob.ID)
if err != nil {
t.Fatal(err)
}