Skip to content

Commit

Permalink
Merge pull request #554 from matrix-org/neilj/room_capabilities
Browse files Browse the repository at this point in the history
test capabilities endpoint
  • Loading branch information
neilisfragile authored Jan 30, 2019
2 parents d3204ce + ed530f7 commit f8933f1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/10apidoc/45server-capabilities.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
my $user_fixture = local_user_fixture();
test "GET /capabilities is present and well formed for registered user",
requires => [ $main::API_CLIENTS[0], $user_fixture],
do => sub {
my ( $http, $user ) = @_;

do_request_json_for( $user,
method => "GET",
uri => "/r0/capabilities",
)->then( sub {
my ( $body ) = @_;
assert_json_keys( $body->{capabilities}, qw( m.room_versions m.change_password ));
Future->done(1);
});
};


test "GET /r0/capabilities is not public",
requires => [ $main::API_CLIENTS[0] ],

do => sub {
my ( $http ) = @_;

$http->do_request_json(
method => "GET",
uri => "/r0/capabilities",
)->main::expect_http_401->then( sub {
Future->done( 1 );
})
};

0 comments on commit f8933f1

Please sign in to comment.