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

Change room_fixture to run matrix_create_room_synced by default #848

Merged
merged 3 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
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
16 changes: 15 additions & 1 deletion tests/10apidoc/33room-members.pl
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,11 @@ =head2 room_fixture
C<$user_fixture> should be a Fixture which will provide a User when
provisioned.

C<opts> can contain a boolean key called C<synced>, which determines whether to
perform a user /sync request after creating the room. This involves inserting
and checking for a 'm.room.test' event in the room state, which may be
undesirable in some cases. Defaults to 1.

Any other options are passed into C<matrix_create_room>, whence they are passed
on to the server.

Expand All @@ -531,7 +536,16 @@ sub room_fixture
setup => sub {
my ( $user ) = @_;

matrix_create_room( $user, %args )->then( sub {
# Determine whether to create room synced or not. Default is synced
#
# This will insert a m.room.test event into room state which
# some tests may not want
my $sync = 1;
if ( exists( $args{synced} ) && $args{synced} == 0 ) {
$sync = 0;
}

( $sync ? matrix_create_room_synced( $user, %args ) : matrix_create_room( $user, %args ) )->then( sub {
my ( $room_id ) = @_;
# matrix_create_room returns the room_id and the room_alias if
# one was set. However we only want to return the room_id
Expand Down
4 changes: 3 additions & 1 deletion tests/30rooms/01state.pl
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ sub set_test_state
}

test "Setting state twice is idempotent",
requires => [ local_user_and_room_fixtures() ],
# Setting synced to 1 inserts a m.room.test object into the
# timeline which this test does not expect
requires => [ local_user_and_room_fixtures( room_opts => { synced => 0 } ) ],

check => sub {
my ( $user, $room_id ) = @_;
Expand Down
4 changes: 3 additions & 1 deletion tests/50federation/33room-get-missing-events.pl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@
foreach my $vis (qw( world_readable shared invite joined )) {
test "Inbound federation can return missing events for $vis visibility",
requires => [ $main::OUTBOUND_CLIENT,
local_user_and_room_fixtures(),
# Setting synced to 1 inserts a m.room.test object into the
# timeline which this test does not expect
local_user_and_room_fixtures( room_opts => { synced => 0 } ),
federation_user_id_fixture() ],

do => sub {
Expand Down