From b8422397ff57cb4f2709db75451db8a97eb19575 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Wed, 29 Jul 2015 11:30:51 -0400 Subject: [PATCH] LP 1198465: Load negative balance test transactions in load_all.sql This commit integrates the SQL needed to setup negative balance testing into the load_all.sql which loads the rest of the test data. It also separates out the "reset" commands into a separate SQL file. They are useful when doing repeated testing, but unnecessary and may eventually require manual tweaking, so they are provided here as a convenience only. Signed-off-by: Dan Wells Signed-off-by: Remington Steed --- Open-ILS/tests/datasets/sql/load_all.sql | 1 + .../sql/neg_bal_custom_transactions.sql | 16 -------------- .../datasets/sql/neg_bal_testing_reset.sql | 22 +++++++++++++++++++ 3 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 Open-ILS/tests/datasets/sql/neg_bal_testing_reset.sql diff --git a/Open-ILS/tests/datasets/sql/load_all.sql b/Open-ILS/tests/datasets/sql/load_all.sql index c9f2da4164..2694af98fe 100644 --- a/Open-ILS/tests/datasets/sql/load_all.sql +++ b/Open-ILS/tests/datasets/sql/load_all.sql @@ -60,6 +60,7 @@ INSERT INTO biblio.record_entry (marc, last_xact_id) -- circs, etc. \i transactions.sql +\i neg_bal_custom_transactions.sql -- clean up the env \i env_destroy.sql diff --git a/Open-ILS/tests/datasets/sql/neg_bal_custom_transactions.sql b/Open-ILS/tests/datasets/sql/neg_bal_custom_transactions.sql index 23588d19d6..c6a2083495 100644 --- a/Open-ILS/tests/datasets/sql/neg_bal_custom_transactions.sql +++ b/Open-ILS/tests/datasets/sql/neg_bal_custom_transactions.sql @@ -1,5 +1,3 @@ -BEGIN; - -- DATA FOR LIVE TESTING LP#1198465: -- Support for Conditional Negative Balances -- @@ -9,19 +7,6 @@ BEGIN; -- NOTE: Org unit settings will be handled in the perl code --- clear bills and payments for our test circs -DELETE FROM money.billing WHERE xact <= 16; -DELETE FROM money.payment WHERE xact <= 16; - --- clear any non-stock settings --- XXX This will need adjusting if new stock settings are added, so --- TODO: Pad out org_unit_settings with a SETVAL like we do for other --- settings -DELETE FROM actor.org_unit_setting WHERE id >= 14; - --- clear out the test workstation (just in case) -DELETE FROM actor.workstation WHERE name = 'BR1-test-09-lp1198465_neg_balances.t'; - -- Setup some LOST circs, and change copy status to LOST UPDATE action.circulation SET xact_start = '2014-05-14 08:39:13.070326-04', @@ -191,4 +176,3 @@ UPDATE money.materialized_billable_xact_summary SET balance_owed = 40.00 WHERE id = 10; UPDATE money.materialized_billable_xact_summary SET balance_owed = 0.70 WHERE id = 11; -COMMIT; diff --git a/Open-ILS/tests/datasets/sql/neg_bal_testing_reset.sql b/Open-ILS/tests/datasets/sql/neg_bal_testing_reset.sql new file mode 100644 index 0000000000..94149e0c00 --- /dev/null +++ b/Open-ILS/tests/datasets/sql/neg_bal_testing_reset.sql @@ -0,0 +1,22 @@ +BEGIN; + +-- RESET DATA FOR LIVE TESTING LP#1198465: +-- Support for Conditional Negative Balances +-- +-- After running this, reload neg_bal_custom_transactions.sql. +-- Once both files are run, the tests should succeed again. + +-- clear bills and payments for our test circs +DELETE FROM money.billing WHERE xact <= 16; +DELETE FROM money.payment WHERE xact <= 16; + +-- clear any non-stock settings +-- XXX This will need adjusting if new stock settings are added, so +-- TODO: Pad out org_unit_settings with a SETVAL like we do for other +-- settings +DELETE FROM actor.org_unit_setting WHERE id >= 14; + +-- clear out the test workstation (just in case) +DELETE FROM actor.workstation WHERE name = 'BR1-test-09-lp1198465_neg_balances.t'; + +COMMIT; -- 2.43.2