Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 3; |
20 |
use Test::More tests => 4; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Mojo; |
22 |
use Test::Mojo; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
Lines 103-108
subtest 'get() tests' => sub {
Link Here
|
103 |
$schema->storage->txn_rollback; |
103 |
$schema->storage->txn_rollback; |
104 |
}; |
104 |
}; |
105 |
|
105 |
|
|
|
106 |
subtest 'get_items() tests' => sub { |
107 |
|
108 |
plan tests => 8; |
109 |
|
110 |
$schema->storage->txn_begin; |
111 |
|
112 |
my $patron = $builder->build_object( |
113 |
{ |
114 |
class => 'Koha::Patrons', |
115 |
value => { flags => 0 } |
116 |
} |
117 |
); |
118 |
my $password = 'thePassword123'; |
119 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
120 |
$patron->discard_changes; |
121 |
my $userid = $patron->userid; |
122 |
|
123 |
my $biblio = $builder->build_sample_biblio(); |
124 |
$t->get_ok("//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items") |
125 |
->status_is(403); |
126 |
|
127 |
$patron->flags(4)->store; |
128 |
|
129 |
$t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items") |
130 |
->status_is(200) |
131 |
->json_is( '' => [], 'No items on the biblio' ); |
132 |
|
133 |
my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
134 |
my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
135 |
|
136 |
$t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items") |
137 |
->status_is(200) |
138 |
->json_is( '' => [ $item_1->to_api, $item_2->to_api ], 'The items are returned' ); |
139 |
|
140 |
$schema->storage->txn_rollback; |
141 |
}; |
142 |
|
106 |
subtest 'delete() tests' => sub { |
143 |
subtest 'delete() tests' => sub { |
107 |
|
144 |
|
108 |
plan tests => 9; |
145 |
plan tests => 9; |
109 |
- |
|
|