From fd0a11c18fbac315b81d04da359ba062d002d916 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Tue, 25 Oct 2022 20:59:04 -0700 Subject: [PATCH] LP1411819 follow-up: add a pgtap test Signed-off-by: Jane Sandberg --- .../lp1411819_allow_patron_renewal_on_max_fines.pg | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/live_t/lp1411819_allow_patron_renewal_on_max_fines.pg diff --git a/Open-ILS/src/sql/Pg/live_t/lp1411819_allow_patron_renewal_on_max_fines.pg b/Open-ILS/src/sql/Pg/live_t/lp1411819_allow_patron_renewal_on_max_fines.pg new file mode 100644 index 0000000000..c4973250f6 --- /dev/null +++ b/Open-ILS/src/sql/Pg/live_t/lp1411819_allow_patron_renewal_on_max_fines.pg @@ -0,0 +1,36 @@ +BEGIN; + +SELECT plan(2); + +INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (1, 'circ.permit_renew_when_exceeds_fines', true); + +INSERT INTO actor.usr_standing_penalty(org_unit, usr, standing_penalty, staff) +SELECT 1, 6, id, 1 FROM config.standing_penalty WHERE name='PATRON_EXCEEDS_FINES'; +UPDATE asset.copy SET status=1 WHERE id=1; -- Checked out, so that we can renew it + +SELECT is( + permit_test.success, + true, + 'user can renew item on max_fines when org setting is true' +) +FROM action.item_user_circ_test( '8', -- org_unit + '1', -- item + '6', -- user + '1' ) -- renewal +AS permit_test LIMIT 1; + +UPDATE actor.org_unit_setting SET value = false WHERE name = 'circ.permit_renew_when_exceeds_fines'; + +SELECT is( + permit_test.success, + false, + 'user cannot renew item on max_fines when org setting is false' +) +FROM action.item_user_circ_test( '8', -- org_unit + '1', -- item + '6', -- user + '1' ) -- renewal +AS permit_test LIMIT 1; + +SELECT * FROM finish(); +ROLLBACK; -- 2.11.0