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

Remove overly-specific room-forgetting test #472

Merged
merged 1 commit into from
Jul 24, 2018
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
62 changes: 1 addition & 61 deletions tests/30rooms/31forget.pl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
})->main::expect_http_4xx;
};

test "Can re-join room if re-invited - history_visibility = shared",
test "Can re-join room if re-invited",
requires => [ local_user_fixture(), local_user_fixture() ],

do => sub {
Expand Down Expand Up @@ -183,66 +183,6 @@
});
};

test "Can re-join room if re-invited - history_visibility joined",
requires => [ local_user_fixture(), local_user_fixture() ],

do => sub {
my ( $creator, $user ) = @_;

my ( $room_id );

matrix_create_room( $creator, invite => [ $user->user_id ] )->then( sub {
( $room_id ) = @_;

log_if_fail "room_id", $room_id;

matrix_put_room_state( $creator, $room_id,
type => "m.room.join_rules",
state_key => "",
content => {
join_rule => "invite",
}
)
})->then( sub {
matrix_set_room_history_visibility( $creator, $room_id, "joined");
})->then( sub {
matrix_join_room( $user, $room_id );
})->then( sub {
matrix_send_room_text_message( $creator, $room_id, body => "before leave" );
})->then( sub {
matrix_leave_room( $user, $room_id );
})->then( sub {
matrix_forget_room( $user, $room_id );
})->then( sub {
matrix_join_room( $user, $room_id )->main::expect_http_403;
})->then( sub {
matrix_invite_user_to_room( $creator, $user, $room_id );
})->then( sub {
matrix_join_room( $user, $room_id );
})->then( sub {
matrix_get_room_messages( $user, $room_id, limit => 100 );
})->then( sub {
my ( $body ) = @_;

none { $_->{type} eq "m.room.message" } @{ $body->{chunk} }
or die "Should not have seen any m.room.message events";

matrix_send_room_text_message( $creator, $room_id, body => "after rejoin" );
})->then( sub {
matrix_get_room_messages( $user, $room_id, limit => 1 );
})->then( sub {
my ( $body ) = @_;

log_if_fail "body", $body;

@{ $body->{chunk} } == 1 or die "Expected event";
$body->{chunk}[0]->{type} eq "m.room.message" && $body->{chunk}[0]->{content}{body} eq "after rejoin"
or die "Got wrong event";

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

push our @EXPORT, qw( matrix_forget_room );

sub matrix_forget_room
Expand Down