Lines 30-36
my $t = Test::Mojo->new('Koha::REST::V1');
Link Here
|
30 |
|
30 |
|
31 |
subtest 'success tests' => sub { |
31 |
subtest 'success tests' => sub { |
32 |
|
32 |
|
33 |
plan tests => 6; |
33 |
plan tests => 9; |
34 |
|
34 |
|
35 |
$schema->storage->txn_begin; |
35 |
$schema->storage->txn_begin; |
36 |
|
36 |
|
Lines 52-61
subtest 'success tests' => sub {
Link Here
|
52 |
); |
52 |
); |
53 |
}); |
53 |
}); |
54 |
|
54 |
|
|
|
55 |
my $stash; |
56 |
$t->app->hook(after_dispatch => sub { $stash = shift->stash }); |
57 |
|
55 |
$t->get_ok("//$userid:$password@/api/v1/patrons") |
58 |
$t->get_ok("//$userid:$password@/api/v1/patrons") |
56 |
->status_is( 200, 'Successful authentication and permissions check' ) |
59 |
->status_is( 200, 'Successful authentication and permissions check' ) |
57 |
->json_is('/userenv/number' => $patron->borrowernumber ); |
60 |
->json_is('/userenv/number' => $patron->borrowernumber ); |
58 |
|
61 |
|
|
|
62 |
my $user = $stash->{'koha.user'}; |
63 |
ok( defined $user, 'The \'koha.user\' object is defined in the stash') and |
64 |
is( ref($user), 'Koha::Patron', 'Stashed koha.user object type is Koha::Patron') and |
65 |
is( $user->borrowernumber, $patron->borrowernumber, 'The stashed user is the right one' ); |
66 |
|
59 |
$patron->flags(undef)->store; |
67 |
$patron->flags(undef)->store; |
60 |
|
68 |
|
61 |
$t->get_ok("//$userid:$password@/api/v1/patrons") |
69 |
$t->get_ok("//$userid:$password@/api/v1/patrons") |
62 |
- |
|
|