Lines 143-150
subtest 'list_rules() tests' => sub {
Link Here
|
143 |
->json_is( '/0/finedays' => 5, "Default finedays rule returned when no library is added to request query" ); |
143 |
->json_is( '/0/finedays' => 5, "Default finedays rule returned when no library is added to request query" ); |
144 |
|
144 |
|
145 |
# Limit to only rules we're interested in |
145 |
# Limit to only rules we're interested in |
146 |
$t->get_ok("//$userid:$password@/api/v1/circulation_rules?rules=fine,finedays")->status_is(200) |
146 |
$t->get_ok("//$userid:$password@/api/v1/circulation_rules?rules=fine,finedays")->status_is(200)->json_is( |
147 |
->json_is( '/0' => { fine => 2, finedays => 5 }, "Only the two rules we asked for are returned" ); |
147 |
'/0' => { |
|
|
148 |
context => { item_type_id => '*', patron_category_id => '*', library_id => '*' }, fine => 2, finedays => 5 |
149 |
}, |
150 |
"Only the two rules we asked for are returned" |
151 |
); |
148 |
|
152 |
|
149 |
# Warn on unsupported query parameter |
153 |
# Warn on unsupported query parameter |
150 |
$t->get_ok("//$userid:$password@/api/v1/circulation_rules?rules_blah=blah")->status_is(400) |
154 |
$t->get_ok("//$userid:$password@/api/v1/circulation_rules?rules_blah=blah")->status_is(400) |
Lines 236-244
subtest 'list_rules() tests' => sub {
Link Here
|
236 |
|
240 |
|
237 |
# First rule set should march default, default, default |
241 |
# First rule set should march default, default, default |
238 |
if ( $index == 0 ) { |
242 |
if ( $index == 0 ) { |
239 |
ok( $pointer->get('/branchcode') eq "*" |
243 |
ok( $pointer->get('/context/library_id') eq "*" |
240 |
&& $pointer->get('/itemtype') eq '*' |
244 |
&& $pointer->get('/context/item_type_id') eq '*' |
241 |
&& $pointer->get('/categorycode') eq '*', "Default rules returned first" ); |
245 |
&& $pointer->get('/context/patron_category_id') eq '*', "Default rules returned first" ); |
242 |
} |
246 |
} |
243 |
|
247 |
|
244 |
# Iterate over the list of expected keys for each hash |
248 |
# Iterate over the list of expected keys for each hash |
Lines 265-273
subtest 'list_rules() tests' => sub {
Link Here
|
265 |
|
269 |
|
266 |
# First (and only) rule set should match branchcode, default, default. |
270 |
# First (and only) rule set should match branchcode, default, default. |
267 |
if ( $index == 0 ) { |
271 |
if ( $index == 0 ) { |
268 |
ok( $pointer->get('/branchcode') eq $branchcode |
272 |
ok( $pointer->get('/context/library_id') eq $branchcode |
269 |
&& $pointer->get('/itemtype') eq '*' |
273 |
&& $pointer->get('/context/item_type_id') eq '*' |
270 |
&& $pointer->get('/categorycode') eq '*', "Branchcode rule set returned when filtered" ); |
274 |
&& $pointer->get('/context/patron_category_id') eq '*', "Branchcode rule set returned when filtered" ); |
271 |
} |
275 |
} |
272 |
|
276 |
|
273 |
# Iterate over the list of expected keys for each hash |
277 |
# Iterate over the list of expected keys for each hash |
274 |
- |
|
|