LP#1440114 Blanket order pgtap tests
authorBill Erickson <berickxx@gmail.com>
Tue, 18 Aug 2015 14:31:50 +0000 (10:31 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 19 Aug 2015 16:33:28 +0000 (12:33 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/sql/Pg/t/blanket_order.pg [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/t/blanket_order.pg b/Open-ILS/src/sql/Pg/t/blanket_order.pg
new file mode 100644 (file)
index 0000000..6f536dc
--- /dev/null
@@ -0,0 +1,28 @@
+BEGIN;
+
+SELECT plan(3);
+
+SELECT has_column('acq', 'invoice_item_type', 
+    'blanket', '"blanket" column created');
+
+-- A type cannot be both blanket and prorate
+
+SELECT throws_ok(
+    'INSERT INTO acq.invoice_item_type 
+        (code, name, prorate, blanket) VALUES (''foo'', ''foo'', TRUE, TRUE)',
+    23514 -- check_violation
+);
+
+SELECT is(
+    (SELECT blanket FROM acq.invoice_item_type WHERE code = 'BLA'),
+    TRUE,
+    'New item type is set to blanket=TRUE'
+);
+
+
+SELECT * FROM finish();
+
+ROLLBACK;
+
+
+