diff --git a/tests/11register.pl b/tests/11register.pl index 63f7c245d..c5b822b61 100644 --- a/tests/11register.pl +++ b/tests/11register.pl @@ -1,3 +1,4 @@ +use utf8; use JSON qw( decode_json ); use URI; @@ -381,3 +382,12 @@ }); }; +test "User signups are forbidden from starting with '_'", + requires => [ $main::API_CLIENTS[0] ], + + do => sub { + my ( $http ) = @_; + + matrix_register_user( $http, "_badname_here" ) + ->main::expect_http_4xx; + }; diff --git a/tests/60app-services/01as-create.pl b/tests/60app-services/01as-create.pl index 7fbb5e251..975d43016 100644 --- a/tests/60app-services/01as-create.pl +++ b/tests/60app-services/01as-create.pl @@ -26,7 +26,7 @@ }); }; -test "AS can create a user with inhibit_login", +test "AS can create a user with an underscore", requires => [ $main::AS_USER[0], $room_fixture ], do => sub { @@ -37,24 +37,21 @@ uri => "/r0/register", content => { - user => "astest-01create-1-$TEST_RUN_ID", - inhibit_login => 1, + user => "_astest-01create-0-$TEST_RUN_ID", }, )->then( sub { my ( $body ) = @_; log_if_fail "Body", $body; - assert_json_keys( $body, qw( user_id home_server )); - foreach ( qw( device_id access_token )) { - exists $body->{$_} and die "Got an unexpected a '$_' key"; - } + assert_json_keys( $body, qw( user_id home_server access_token device_id )); Future->done(1); }); }; -test "AS can create a user via the legacy /v1 endpoint", + +test "AS can create a user with inhibit_login", requires => [ $main::AS_USER[0], $room_fixture ], do => sub { @@ -62,11 +59,11 @@ do_request_json_for( $as_user, method => "POST", - uri => "/api/v1/register", + uri => "/r0/register", content => { - type => "m.login.application_service", - user => "astest-01create-2-$TEST_RUN_ID", + user => "astest-01create-1-$TEST_RUN_ID", + inhibit_login => 1, }, )->then( sub { my ( $body ) = @_; @@ -74,6 +71,9 @@ log_if_fail "Body", $body; assert_json_keys( $body, qw( user_id home_server )); + foreach ( qw( device_id access_token )) { + exists $body->{$_} and die "Got an unexpected a '$_' key"; + } Future->done(1); }); diff --git a/tests/90jira/SYN-738.pl b/tests/90jira/SYN-738.pl deleted file mode 100644 index 53760d94e..000000000 --- a/tests/90jira/SYN-738.pl +++ /dev/null @@ -1,26 +0,0 @@ -test "User signups are forbidden from starting with '_'", - requires => [ $main::API_CLIENTS[0] ], - - do => sub { - my ( $http ) = @_; - - matrix_register_user( $http, "_badname_here" ) - ->main::expect_http_4xx; - }; - -test "AS can create users starting with '_'", - requires => [ $main::AS_USER[0] ], - - do => sub { - my ( $as_user ) = @_; - - do_request_json_for( $as_user, - method => "POST", - uri => "/api/v1/register", - - content => { - type => "m.login.application_service", - user => "_astest-goes-here", - }, - ); - };