Skip to content

Commit

Permalink
Merge pull request #128 from matrix-org/erikj/create_room_3pid_invite
Browse files Browse the repository at this point in the history
Test support for inviting 3pids in /createRoom
  • Loading branch information
erikjohnston committed Jan 5, 2016
2 parents e19f9c6 + 765ef45 commit 598a13f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/10apidoc/30room-create.pl
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ sub matrix_create_room
( room_alias_name => $opts{room_alias_name} ) : () ),
( defined $opts{invite} ?
( invite => $opts{invite} ) : () ),
( defined $opts{invite_3pid} ?
( invite_3pid => $opts{invite_3pid} ) : () ),
( defined $opts{creation_content} ?
( creation_content => $opts{creation_content} ) : () ),
}
Expand Down
36 changes: 36 additions & 0 deletions tests/30rooms/12thirdpartyinvite.pl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,42 @@
});
};

test "Can invite existing 3pid in createRoom",
requires => [ local_user_fixtures( 2 ), id_server_fixture() ],

do => sub {
my ( $inviter, $invitee, $id_server ) = @_;

my $invitee_mxid = $invitee->user_id;

my $room_id;

$id_server->bind_identity( undef, "email", $invitee_email, $invitee )
->then( sub {
my $invite_info = {
medium => "email",
address => $invitee_email,
id_server => $id_server->name,
};
matrix_create_room( $inviter, invite_3pid => [ $invite_info ] )
->then( sub {
( $room_id ) = @_;

matrix_get_room_state( $inviter, $room_id,
type => "m.room.member",
state_key => $invitee_mxid,
)->on_done( sub {
my ( $body ) = @_;

log_if_fail "Body", $body;
assert_eq( $body->{membership}, "invite",
'invited user membership' );
});
});
});
};


test "Can invite unbound 3pid",
requires => [ local_user_fixtures( 2 ), $main::HOMESERVER_INFO[0],
id_server_fixture() ],
Expand Down

0 comments on commit 598a13f

Please sign in to comment.