Skip to content
Merged
Changes from all commits
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
112 changes: 0 additions & 112 deletions tests/30rooms/70publicroomslist.pl
Original file line number Diff line number Diff line change
@@ -1,115 +1,3 @@
test "Name/topic keys are correct",
requires => [ $main::API_CLIENTS[0], local_user_fixture() ],

check => sub {
my ( $http, $user ) = @_;

my %rooms = (
publicroomalias_no_name => {},
publicroomalias_with_name => {
name => "name_1",
},
publicroomalias_with_topic => {
topic => "topic_1",
},
publicroomalias_with_name_topic => {
name => "name_2",
topic => "topic_2",
},
publicroom_with_unicode_chars_name => {
name => "un nom français",
},
publicroom_with_unicode_chars_topic => {
topic => "un topic à la française",
},
publicroom_with_unicode_chars_name_topic => {
name => "un nom français",
topic => "un topic à la française",
},
);

Future->needs_all( map {
my $alias_local = $_;
my $room = $rooms{$alias_local};

matrix_create_room_synced( $user,
visibility => "public",
room_alias_name => $alias_local,
%{$room},
)->on_done( sub {
my ( $room_id ) = @_;
log_if_fail "Created room $room_id with alias $alias_local";
});
} keys %rooms )
->then( sub {
my $iter = 0;
retry_until_success {
$http->do_request_json(
method => "GET",
uri => "/v3/publicRooms",
)->then( sub {
my ( $body ) = @_;

$iter++;
log_if_fail "Iteration $iter: publicRooms result", $body;

assert_json_keys( $body, qw( chunk ));
assert_json_list( $body->{chunk} );

my %isOK = map {
$_ => 0,
} keys ( %rooms );

foreach my $room ( @{ $body->{chunk} } ) {
assert_json_keys( $room,
qw( world_readable guest_can_join num_joined_members )
);

my $name = $room->{name};
my $topic = $room->{topic};
my $canonical_alias = $room->{canonical_alias};

next unless $canonical_alias;

foreach my $alias_local ( keys %rooms ) {
$canonical_alias =~ m/^\Q#$alias_local:\E/ or next;

my $room_config = $rooms{$alias_local};

assert_eq( $room->{num_joined_members}, 1, "member count for '$alias_local'" );

# The rooms should get created "atomically", so we should never
# see any out of the public rooms list in the wrong state. If
# we see a room we expect it to already be in the right state.

if( defined $name ) {
assert_eq( $room_config->{name}, $name, "room name for '$alias_local'" );
}
else {
defined $room_config->{name} and die "Expected not to find a name for '$alias_local'";
}

if( defined $topic ) {
assert_eq( $room_config->{topic}, $topic, "room topic for '$alias_local'" );
}
else {
defined $room_config->{topic} and die "Expected not to find a topic for '$alias_local'";
}

$isOK{$alias_local} = 1;
}
}

foreach my $alias ( keys %rooms ) {
$isOK{$alias} or die "$alias not found in result";
}

Future->done( 1 );
});
};
});
};

test "Can get remote public room list",
requires => [ $main::HOMESERVER_INFO[0], local_user_fixture(), remote_user_fixture() ],

Expand Down
Loading