mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-14 05:12:26 +03:00
[pseudoIDs] Fixes for room alias tests (#3159)
Some (deceptively) simple fixes for some bugs that caused room alias
tests to fail (sytext `tests/30rooms/05aliases.pl`). Each commit has
details about what it fixes.
Sytest results:
- Sytest before (79d4a0e
):
https://gist.github.com/swedgwood/972ac4ef93edd130d3db0930703d6c82
- Sytest after (4b09bed):
https://gist.github.com/swedgwood/504b00ac4ee892acb757b7fac55fa28a
Room aliases go from `8/15` to `15/15`, but looks like these fixes also
managed to fix about `4` other tests, which is a nice bonus :)
Signed-off-by: `Sam Wedgwood <sam@wedgwood.dev>`
This commit is contained in:
parent
3f727485d6
commit
af13fa1c75
8 changed files with 160 additions and 138 deletions
|
@ -227,6 +227,11 @@ func TestPurgeRoom(t *testing.T) {
|
|||
bob := test.NewUser(t)
|
||||
room := test.NewRoom(t, alice, test.RoomPreset(test.PresetTrustedPrivateChat))
|
||||
|
||||
roomID, err := spec.NewRoomID(room.ID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Invite Bob
|
||||
inviteEvent := room.CreateAndInsert(t, alice, spec.MRoomMember, map[string]interface{}{
|
||||
"membership": "invite",
|
||||
|
@ -274,9 +279,7 @@ func TestPurgeRoom(t *testing.T) {
|
|||
if !isPublished {
|
||||
t.Fatalf("room should be published before purging")
|
||||
}
|
||||
|
||||
aliasResp := &api.SetRoomAliasResponse{}
|
||||
if err = rsAPI.SetRoomAlias(ctx, &api.SetRoomAliasRequest{RoomID: room.ID, Alias: "myalias", UserID: alice.ID}, aliasResp); err != nil {
|
||||
if _, err = rsAPI.SetRoomAlias(ctx, spec.SenderID(alice.ID), *roomID, "myalias"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// check the alias is actually there
|
||||
|
@ -930,14 +933,17 @@ func TestUpgrade(t *testing.T) {
|
|||
upgradeUser: alice.ID,
|
||||
roomFunc: func(rsAPI api.RoomserverInternalAPI) string {
|
||||
r := test.NewRoom(t, alice)
|
||||
roomID, err := spec.NewRoomID(r.ID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := api.SendEvents(ctx, rsAPI, api.KindNew, r.Events(), "test", "test", "test", nil, false); err != nil {
|
||||
t.Errorf("failed to send events: %v", err)
|
||||
}
|
||||
|
||||
if err := rsAPI.SetRoomAlias(ctx, &api.SetRoomAliasRequest{
|
||||
RoomID: r.ID,
|
||||
Alias: "#myroomalias:test",
|
||||
}, &api.SetRoomAliasResponse{}); err != nil {
|
||||
if _, err := rsAPI.SetRoomAlias(ctx, spec.SenderID(alice.ID),
|
||||
*roomID,
|
||||
"#myroomalias:test"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue