|
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 => 17; |
| 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_id' => $itype, 'item-level_itypes:0' ) |
| 153 |
->json_is( '/effective_item_type_id' => $biblio->itemtype, 'item-level_itypes:0' ); |
| 154 |
|
| 155 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); |
| 156 |
|
| 157 |
$t->get_ok( "//$userid:$password@/api/v1/items/" . $item->itemnumber ) |
| 158 |
->status_is( 200, 'SWAGGER3.2.2' ) |
| 159 |
->json_is( '/item_type_id' => $itype, 'item-level_itype:1' ) |
| 160 |
->json_is( '/effective_item_type_id' => $itype, 'item-level_itypes:1' ); |
| 161 |
|
| 142 |
$schema->storage->txn_rollback; |
162 |
$schema->storage->txn_rollback; |
| 143 |
}; |
163 |
}; |
| 144 |
|
164 |
|
| 145 |
- |
|
|