From ed530f776b6e81b3733357b5ba67219f08db4968 Mon Sep 17 00:00:00 2001 From: Neil Johnson Date: Wed, 30 Jan 2019 14:33:12 +0000 Subject: [PATCH] test capabilities end point --- tests/10apidoc/45server-capabilities.pl | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/10apidoc/45server-capabilities.pl diff --git a/tests/10apidoc/45server-capabilities.pl b/tests/10apidoc/45server-capabilities.pl new file mode 100644 index 000000000..3d24c6d85 --- /dev/null +++ b/tests/10apidoc/45server-capabilities.pl @@ -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 ); + }) + };