Skip to content

Commit

Permalink
Add test for querying remote public rooms list with local server_name (
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Apr 6, 2020
1 parent e207619 commit 30116ad
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion tests/30rooms/70publicroomslist.pl
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,59 @@

content => {
filter => {
generic_search_term => "wombles", # Search case insesitively
generic_search_term => "wombles", # Search case insensitively
}
},
)->then( sub {
my ( $body ) = @_;

log_if_fail "Body", $body;

assert_json_keys( $body, qw( chunk ) );

# We only expect to find a single result
assert_eq( scalar @{ $body->{chunk} }, 1 );
assert_eq( $body->{chunk}[0]{room_id}, $room_id );

Future->done( 1 );
})->on_fail( sub {
my ( $exc ) = @_;
chomp $exc;
log_if_fail "Failed to search room dir: $exc";
});
}
})
};

test "Asking for a remote rooms list, but supplying the local server's name, returns the local rooms list",
requires => [ local_user_fixture() ],

check => sub {
my ( $local_user ) = @_;

my $room_id;

matrix_create_room( $local_user,
visibility => "public",
name => "Test Name",
topic => "Test Topic Wibbles",
)->then( sub {
( $room_id ) = @_;

retry_until_success {
do_request_json_for( $local_user,
method => "POST",
uri => "/r0/publicRooms",

# Ask the local server for a remote room list, but supply the local server's server_name
# Server should return the local public rooms list
params => {
server => $local_user->server_name,
},

content => {
filter => {
generic_search_term => "wibbles", # Search case insensitively
}
},
)->then( sub {
Expand Down

0 comments on commit 30116ad

Please sign in to comment.