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

Update tests for propagating canonical alias when upgrading a room #812

Merged
merged 2 commits into from
Feb 20, 2020
Merged
Changes from 1 commit
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
33 changes: 6 additions & 27 deletions tests/30rooms/60version_upgrade.pl
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,8 @@ sub upgrade_room_synced {
matrix_put_room_state( $creator, $room_id,
type => "m.room.canonical_alias",
content => {
alias => $room_alias_1,
alias => $room_alias_1,
alt_aliases => [$room_alias_2],
},
);
})->then( sub {
Expand All @@ -692,46 +693,24 @@ sub upgrade_room_synced {
);
})->then( sub {
( $new_room_id ) = @_;

# m.room.aliases are filtered out until a better solution to mitigating abuse is is specced.
#
# matrix_get_room_state(
# $creator, $room_id,
# type=>'m.room.aliases', state_key=>$server_name,
# );
# })->then( sub {
# my ( $old_aliases ) = @_;
# assert_deeply_eq( $old_aliases, {aliases => []}, "aliases on old room" );

matrix_get_room_state( $creator, $room_id, type=>'m.room.canonical_alias' );
})->then( sub {
my ( $old_canonical_alias ) = @_;
assert_deeply_eq(
$old_canonical_alias, {}, "canonical_alias on old room",
);

# m.room.aliases are filtered out until a better solution to mitigating abuse is is specced.
#
# matrix_get_room_state(
# $creator, $new_room_id,
# type=>'m.room.aliases', state_key=>$server_name,
# );
# })->then( sub {
# my ( $new_aliases ) = @_;
# assert_deeply_eq(
# [ sort( @{ $new_aliases->{aliases} } ) ],
# [ sort( $room_alias_1, $room_alias_2 ) ],
# "aliases on new room",
# );

matrix_get_room_state(
$creator, $new_room_id, type=>'m.room.canonical_alias',
);
})->then( sub {
my ( $new_canonical_alias ) = @_;
assert_deeply_eq(
$new_canonical_alias,
{ alias => $room_alias_1 },
{
alias => $room_alias_1,
alt_aliases => [$room_alias_2],
},
"canonical_alias on new room",
);

Expand Down