From 2b721198d9947d6fd0d6940ac042a9cdd87a95bf Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 18 Sep 2018 11:21:26 -0400 Subject: [PATCH] LP#1787274 One active transit pgtap tests Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- .../sql/Pg/live_t/lp1787274-no-dupe-transits.pg | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/live_t/lp1787274-no-dupe-transits.pg 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; -- 2.11.0