LP#1474051 PGTAP test checking dropped columns
authorBill Erickson <berickxx@gmail.com>
Mon, 13 Jul 2015 19:19:35 +0000 (15:19 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 13 Jul 2015 19:32:04 +0000 (15:32 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/sql/Pg/t/lp1474051-drop-cc-columns.pg [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/t/lp1474051-drop-cc-columns.pg b/Open-ILS/src/sql/Pg/t/lp1474051-drop-cc-columns.pg
new file mode 100644 (file)
index 0000000..effd391
--- /dev/null
@@ -0,0 +1,42 @@
+\set ECHO none
+\set QUIET 1
+-- Turn off echo and keep things quiet.
+
+-- Format the output for nice TAP.
+\pset format unaligned
+\pset tuples_only true
+\pset pager
+
+-- Revert all changes on failure.
+\set ON_ERROR_ROLLBACK 1
+\set ON_ERROR_STOP true
+\set QUIET 1
+
+-- Load the TAP functions.
+BEGIN;
+
+-- Plan the tests.
+SELECT plan(7);
+
+-- Run the tests.
+
+SELECT hasnt_column('money', 'credit_card_payment', 'cc_type', 
+    'Column "cc_type" on money.credit_card_payment should not exist');
+SELECT hasnt_column('money', 'credit_card_payment', 'cc_number', 
+    'Column "cc_number" on money.credit_card_payment should not exist');
+SELECT hasnt_column('money', 'credit_card_payment', 'expire_month', 
+    'Column "expire_month" on money.credit_card_payment should not exist');
+SELECT hasnt_column('money', 'credit_card_payment', 'expire_year', 
+    'Column "expire_year" on money.credit_card_payment should not exist');
+SELECT hasnt_column('money', 'credit_card_payment', 'cc_first_name', 
+    'Column "cc_first_name" on money.credit_card_payment should not exist');
+SELECT hasnt_column('money', 'credit_card_payment', 'cc_last_name', 
+    'Column "cc_last_name" on money.credit_card_payment should not exist');
+
+-- make sure at least one column does exist
+SELECT has_column('money', 'credit_card_payment', 'approval_code', 
+    'Column "approval_code" on money.credit_card_payment should exist');
+
+-- Finish the tests and clean up.
+SELECT * FROM finish();
+ROLLBACK;