Lines 101-107
subtest 'list() tests' => sub {
Link Here
|
101 |
|
101 |
|
102 |
subtest 'get() tests' => sub { |
102 |
subtest 'get() tests' => sub { |
103 |
|
103 |
|
104 |
plan tests => 9; |
104 |
plan tests => 15; |
105 |
|
105 |
|
106 |
$schema->storage->txn_begin; |
106 |
$schema->storage->txn_begin; |
107 |
|
107 |
|
Lines 139-144
subtest 'get() tests' => sub {
Link Here
|
139 |
->status_is(404) |
139 |
->status_is(404) |
140 |
->json_is( '/error' => 'Item not found' ); |
140 |
->json_is( '/error' => 'Item not found' ); |
141 |
|
141 |
|
|
|
142 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); |
143 |
|
144 |
my $biblio = $builder->build_sample_biblio; |
145 |
my $itype = |
146 |
$builder->build_object( { class => 'Koha::ItemTypes' } )->itemtype; |
147 |
$item = $builder->build_sample_item( |
148 |
{ biblionumber => $biblio->biblionumber, itype => $itype } ); |
149 |
|
150 |
$t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) |
151 |
->status_is( 200, 'SWAGGER3.2.2' ) |
152 |
->json_is( '/item_type' => $biblio->itemtype, 'item-level_itypes:0' ); |
153 |
|
154 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); |
155 |
|
156 |
$t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) |
157 |
->status_is( 200, 'SWAGGER3.2.2' ) |
158 |
->json_is( '/item_type' => $itype, 'item-level_itype:1' ); |
159 |
|
142 |
$schema->storage->txn_rollback; |
160 |
$schema->storage->txn_rollback; |
143 |
}; |
161 |
}; |
144 |
|
162 |
|
145 |
- |
|
|