-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for matrix-org/synapse#1563
Currently fails on Synapse.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package tests | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/matrix-org/complement/internal/b" | ||
"github.com/matrix-org/complement/internal/client" | ||
) | ||
|
||
// 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) { | ||
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"}) | ||
} |