]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/live_t/patron_exceeds_overdue_count.pg
LP 2061136 follow-up: ng lint --fix
[working/Evergreen.git] / Open-ILS / src / sql / Pg / live_t / patron_exceeds_overdue_count.pg
1 BEGIN;
2
3 SELECT plan(3);
4
5 SELECT is(
6     fail_part,
7     NULL,
8     'When no penalty on the account, it does not return MAX_ITEMS failure'
9 ) FROM action.item_user_circ_test(
10     7, -- org unit
11     2351, -- item
12     1); -- patron
13
14 -- Add a PATRON_EXCEEDS_OVERDUE_COUNT standing penalty to this patron
15 -- at the circulating org_unit
16 INSERT INTO actor.usr_standing_penalty (id, org_unit, usr, standing_penalty)
17     VALUES (
18         9999, -- id
19         7, -- org unit
20         1, -- patron
21         2 -- penalty (PATRON_EXCEEDS_OVERDUE_COUNT)
22     );
23
24 SELECT is(
25     fail_part,
26     'PATRON_EXCEEDS_OVERDUE_COUNT',
27     'When patron has the PATRON_EXCEEDS_OVERDUE_COUNT penalty, it returns a descriptive failure'
28 ) FROM action.item_user_circ_test(
29     7, -- org unit
30     2351, -- item
31     1); -- patron;
32
33 -- Let's try again, this time with the PATRON_EXCEEDS_OVERDUE_COUNT
34 -- standing penalty at the consortium level
35 UPDATE actor.usr_standing_penalty
36     SET org_unit = 1
37     WHERE id = 9999;
38
39 SELECT is(
40     fail_part,
41     'PATRON_EXCEEDS_OVERDUE_COUNT',
42     'When patron has the PATRON_EXCEEDS_OVERDUE_COUNT penalty, it returns a descriptive failure'
43 ) FROM action.item_user_circ_test(
44     7, -- org unit
45     2351, -- item
46     1); -- patron;
47
48 ROLLBACK;