Skip to content

Commit

Permalink
Test /make_join when applied to an empty room (#917)
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Jul 16, 2020
1 parent 47dc1e3 commit ee8a32c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/50federation/30room-join.pl
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,41 @@ sub assert_is_valid_pdu {
};


test "Inbound /make_join rejects attempts to join rooms where all users have left",
requires => [
$main::OUTBOUND_CLIENT,
local_user_and_room_fixtures(),
federation_user_id_fixture(),
],

do => sub {
my ( $outbound_client, $creator, $room_id, $user_id ) = @_;

my $first_home_server = $creator->server_name;

# initially, a make_join should be accepted
$outbound_client->make_join(
server_name => $first_home_server,
room_id => $room_id,
user_id => $user_id,
)->then( sub {
my ( $body ) = @_;
log_if_fail "Initial make_join response", $body;

matrix_leave_room_synced( $creator, $room_id );
})->then( sub {
log_if_fail "Creator left room";

# now we expect a 404
$outbound_client->make_join(
server_name => $first_home_server,
room_id => $room_id,
user_id => $user_id,
)->main::expect_m_not_found();
});
};


test "Inbound /v1/send_join rejects incorrectly-signed joins",
requires => [
$main::OUTBOUND_CLIENT,
Expand Down

0 comments on commit ee8a32c

Please sign in to comment.