From: Bill Erickson Date: Fri, 21 Sep 2018 19:53:23 +0000 (-0400) Subject: LP#1793802 Aged billings/payments PGTAP tests X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7d264985517d85986fbe00bee6a947bd36241530;p=evergreen%2Fequinox.git LP#1793802 Aged billings/payments PGTAP tests Signed-off-by: Bill Erickson Signed-off-by: Chris Sharp Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/sql/Pg/live_t/lp1793802-aged-billings-payments.pg b/Open-ILS/src/sql/Pg/live_t/lp1793802-aged-billings-payments.pg new file mode 100644 index 0000000000..cce5ce1abf --- /dev/null +++ b/Open-ILS/src/sql/Pg/live_t/lp1793802-aged-billings-payments.pg @@ -0,0 +1,47 @@ +-- Load the TAP functions. +BEGIN; + +-- Plan the tests. +SELECT plan(8); + +SELECT is( + (SELECT COUNT(*) FROM money.billing WHERE xact = 9), + 1::BIGINT, 'Confirm billing for xact exists' +); + +SELECT is( + (SELECT COUNT(*) FROM money.payment WHERE xact = 9), + 1::BIGINT, 'Confirm payment for xact exists' +); + +PREPARE age_circ AS DELETE FROM action.circulation WHERE id = 9; +SELECT lives_ok('age_circ', 'Age circulation without errors'); + +SELECT is( + (SELECT COUNT(*) FROM action.aged_circulation WHERE id = 9), + 1::BIGINT, 'Confirm circ aged' +); + +SELECT is( + (SELECT COUNT(*) FROM money.aged_billing WHERE xact = 9), + 1::BIGINT, 'Confirm aged billing created' +); + +SELECT is( + (SELECT COUNT(*) FROM money.aged_payment WHERE xact = 9), + 1::BIGINT, 'Confirm aged payment created' +); + +SELECT is( + (SELECT COUNT(*) FROM money.billing WHERE xact = 9), + 0::BIGINT, 'Confirm source billing deleted' +); + +SELECT is( + (SELECT COUNT(*) FROM money.payment WHERE xact = 9), + 0::BIGINT, 'Confirm source payment deleted' +); + +-- Finish the tests and clean up. +SELECT * FROM finish(); +ROLLBACK;