From: Bill Erickson <berickxx@gmail.com> Date: Tue, 18 Sep 2018 15:21:26 +0000 (-0400) Subject: LP#1787274 One active transit pgtap tests X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2b721198d9947d6fd0d6940ac042a9cdd87a95bf;p=evergreen%2Fjoelewis.git LP#1787274 One active transit pgtap tests Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Kathy Lussier <klussier@masslnc.org> --- diff --git a/Open-ILS/src/sql/Pg/live_t/lp1787274-no-dupe-transits.pg b/Open-ILS/src/sql/Pg/live_t/lp1787274-no-dupe-transits.pg new file mode 100644 index 0000000000..41ec62862f --- /dev/null +++ b/Open-ILS/src/sql/Pg/live_t/lp1787274-no-dupe-transits.pg @@ -0,0 +1,39 @@ +-- Load the TAP functions. +BEGIN; + +-- Plan the tests. +SELECT plan(6); + +-- Run the tests. + +PREPARE insert_transit AS + INSERT INTO action.transit_copy + (target_copy, source, dest, copy_status) VALUES (4003, 4, 7, 0); + +PREPARE insert_hold_transit AS + INSERT INTO action.hold_transit_copy + (target_copy, source, dest, copy_status) VALUES (4003, 4, 7, 8); + +PREPARE insert_reservation_transit AS + INSERT INTO action.reservation_transit_copy + (target_copy, source, dest, copy_status) VALUES (4003, 4, 7, 8); + +SELECT lives_ok('insert_transit', 'First transit inserts OK'); + +SELECT is( + (SELECT COUNT(*) FROM action.transit_copy WHERE target_copy = 4003)::INT, + 1, 'Confirm a single transit exists'); + +SELECT throws_ok('insert_transit'); + +SELECT throws_ok('insert_hold_transit'); + +SELECT throws_ok('insert_reservation_transit'); + +SELECT is( + (SELECT COUNT(*) FROM action.transit_copy WHERE target_copy = 4003)::INT, + 1, 'Confirm a single transit exists'); + +-- Finish the tests and clean up. +SELECT * FROM finish(); +ROLLBACK;