@@ -, +, @@ user --- t/db_dependent/api/v1/auth_basic.t | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/t/db_dependent/api/v1/auth_basic.t +++ a/t/db_dependent/api/v1/auth_basic.t @@ -30,7 +30,7 @@ my $t = Test::Mojo->new('Koha::REST::V1'); subtest 'success tests' => sub { - plan tests => 6; + plan tests => 9; $schema->storage->txn_begin; @@ -52,10 +52,18 @@ subtest 'success tests' => sub { ); }); + my $stash; + $t->app->hook(after_dispatch => sub { $stash = shift->stash }); + $t->get_ok("//$userid:$password@/api/v1/patrons") ->status_is( 200, 'Successful authentication and permissions check' ) ->json_is('/userenv/number' => $patron->borrowernumber ); + my $user = $stash->{'koha.user'}; + ok( defined $user, 'The \'koha.user\' object is defined in the stash') and + is( ref($user), 'Koha::Patron', 'Stashed koha.user object type is Koha::Patron') and + is( $user->borrowernumber, $patron->borrowernumber, 'The stashed user is the right one' ); + $patron->flags(undef)->store; $t->get_ok("//$userid:$password@/api/v1/patrons") --