From 7d264985517d85986fbe00bee6a947bd36241530 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 21 Sep 2018 15:53:23 -0400 Subject: [PATCH] LP#1793802 Aged billings/payments PGTAP tests Signed-off-by: Bill Erickson Signed-off-by: Chris Sharp Signed-off-by: Galen Charlton --- .../lp1793802-aged-billings-payments.pg | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/live_t/lp1793802-aged-billings-payments.pg 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; -- 2.43.2