Skip to content

Commit

Permalink
Change room_fixture to run matrix_create_room_synced by default (#848)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Apr 9, 2020
1 parent fbc3c4a commit e2ce53f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
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

0 comments on commit e2ce53f

Please sign in to comment.