Skip to content

Commit

Permalink
Add an additional tests for M_BAD_ALIAS.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Mar 9, 2020
1 parent 22b843b commit be1d098
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/30rooms/05aliases.pl
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,26 @@
}
)->main::expect_matrix_error( 400, "M_INVALID_PARAM" )
->SyTest::pass_on_done( "m.room.canonical_alias rejects invalid aliases" );
})->then( sub {
# Create a second room with an alias on it.
my $other_alias_name = $room_alias_name . "2";

matrix_create_room( $user,
room_alias_name => $other_alias_name,
)->then( sub {
my ( $other_room_id, $other_room_alias ) = @_;

# Attempt to set a canonical alias for the original room using an
# alias from the second room.
matrix_put_room_state( $user, $room_id,
type => "m.room.canonical_alias",
content => {
alias => $room_alias,
alt_aliases => [ $other_room_alias ],
}
)->main::expect_matrix_error( 400, "M_BAD_ALIAS" )
->SyTest::pass_on_done( "m.room.canonical_alias rejects alias pointing to different room" );
})
});
};

Expand Down

0 comments on commit be1d098

Please sign in to comment.