]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/live_t/lp1464709-copy-stat-co-ok.live.pg
LP#1464709 Rename checkout_ok to is_available
[working/Evergreen.git] / Open-ILS / src / sql / Pg / live_t / lp1464709-copy-stat-co-ok.live.pg
1 \set ECHO none
2 \set QUIET 1
3 -- Turn off echo and keep things quiet.
4
5 -- Format the output for nice TAP.
6 \pset format unaligned
7 \pset tuples_only true
8 \pset pager
9
10 -- Revert all changes on failure.
11 \set ON_ERROR_ROLLBACK 1
12 \set ON_ERROR_STOP true
13 \set QUIET 1
14
15 -- Load the TAP functions.
16 BEGIN;
17
18 -- Plan the tests.
19 SELECT plan(3);
20
21 SELECT is(
22     fail_part,
23     NULL,
24     'Checkout test Available succeeds'
25 ) FROM action.item_user_circ_test(4, 1, 1);
26
27 -- is_available defaults to false
28 INSERT into config.copy_status (id, name) VALUES (101, 'lp1464709');
29 UPDATE asset.copy SET status = 101 WHERE id = 1;
30
31 SELECT is(
32     fail_part,
33     'asset.copy.status',
34     'Checkout test is_available=false fails'
35 ) FROM action.item_user_circ_test(4, 1, 1);
36
37 UPDATE config.copy_status SET is_available = TRUE WHERE name = 'lp1464709';
38
39 SELECT is(
40     fail_part,
41     NULL,
42     'Checkout test is_available=true succeeds'
43 ) FROM action.item_user_circ_test(4, 1, 1);
44
45
46 -- Finish the tests and clean up.
47 SELECT * FROM finish();
48 ROLLBACK;