Skip to content

Commit

Permalink
LP 1198465: Load negative balance test transactions in load_all.sql
Browse files Browse the repository at this point in the history
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 <dbw2@calvin.edu>
Signed-off-by: Remington Steed <rjs7@calvin.edu>
  • Loading branch information
hektech committed Jul 29, 2015
1 parent 3a6c040 commit b842239
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
1 change: 1 addition & 0 deletions Open-ILS/tests/datasets/sql/load_all.sql
Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions 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
--
Expand All @@ -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',
Expand Down Expand Up @@ -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;
22 changes: 22 additions & 0 deletions 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;

0 comments on commit b842239

Please sign in to comment.