Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression test for matrix-org/synapse#1563 #288

Merged
merged 2 commits into from
Jan 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions tests/federation_room_ban_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package tests

import (
"testing"

"github.com/matrix-org/complement/internal/b"
"github.com/matrix-org/complement/internal/client"
"github.com/matrix-org/complement/runtime"
)

// Regression test for https://github.com/matrix-org/synapse/issues/1563
// Create a federation room. Bob bans Alice. Bob unbans Alice. Bob invites Alice (unbanning her). Ensure the invite is
// received and can be accepted.
func TestUnbanViaInvite(t *testing.T) {
runtime.SkipIf(t, runtime.Synapse) // https://github.com/matrix-org/synapse/issues/1563
deployment := Deploy(t, b.BlueprintFederationOneToOneRoom)
defer deployment.Destroy(t)

alice := deployment.Client(t, "hs1", "@alice:hs1")
bob := deployment.Client(t, "hs2", "@bob:hs2")

roomID := bob.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
})
alice.JoinRoom(t, roomID, []string{"hs2"})

// Ban Alice
bob.MustDoFunc(t, "POST", []string{"_matrix", "client", "r0", "rooms", roomID, "ban"}, client.WithJSONBody(t, map[string]interface{}{
"user_id": alice.UserID,
}))
alice.MustSyncUntil(t, client.SyncReq{}, client.SyncLeftFrom(alice.UserID, roomID))

// Unban Alice
bob.MustDoFunc(t, "POST", []string{"_matrix", "client", "r0", "rooms", roomID, "unban"}, client.WithJSONBody(t, map[string]interface{}{
"user_id": alice.UserID,
}))
bob.MustSyncUntil(t, client.SyncReq{}, client.SyncLeftFrom(alice.UserID, roomID))

// Re-invite Alice
bob.InviteRoom(t, roomID, alice.UserID)
bob.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(alice.UserID, roomID))
alice.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(alice.UserID, roomID))

// Alice accepts (this is what previously failed in the issue)
alice.JoinRoom(t, roomID, []string{"hs2"})
}