From: Remington Steed Date: Fri, 20 Feb 2015 14:57:18 +0000 (-0500) Subject: LP#1379815 Add pgTAP test X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8df8d6be077fbaf5360c379e3ee1f0934dcc9dd0;p=evergreen%2Fmasslnc.git LP#1379815 Add pgTAP test This commit adds a pgTAP test which ensures that imported items are being successfully added to the 'import_item' table. The test confirms that the correct number of items have stat cat data in the table. The test also ensures that the new xpath function works properly, simply by using it. Signed-off-by: Remington Steed Signed-off-by: Ben Shum --- diff --git a/Open-ILS/src/sql/Pg/t/regress/lp1379815_vl_import_item_stat_cats.pg b/Open-ILS/src/sql/Pg/t/regress/lp1379815_vl_import_item_stat_cats.pg new file mode 100644 index 0000000000..17562667af --- /dev/null +++ b/Open-ILS/src/sql/Pg/t/regress/lp1379815_vl_import_item_stat_cats.pg @@ -0,0 +1,52 @@ +BEGIN; + +SELECT plan(1); + +------------------------- +-- Setup test environment +-- Circ modifier +-- Vandelay settings (queue, import_item_attr_definition) +-- Bib record added to Vandelay queue +-- including items with stat cat data +------------------------- + +INSERT INTO config.circ_modifier (code, name, description, sip2_media_type) + VALUES ('TEST', 'TEST', 'TEST', 'TEST'); + +INSERT INTO vandelay.import_item_attr_definition ( + owner, name, tag, owning_lib, circ_lib, + call_number, internal_id, status, location, + barcode, circ_modifier, stat_cat_data) +VALUES ( + 1, 'TEST', '999', 'b', 'b', + 'j', 'e', 'z', 'c', + 'p', 'a', 'd'); + +INSERT INTO vandelay.bib_queue (owner, name, item_attr_def) + VALUES (1, 'TEST', CURRVAL('vandelay.import_item_attr_definition_id_seq')); + +---------------------- +-- Add record to queue +-- This triggers ingest_bib_items() +-- which calls ingest_items() +---------------------- +INSERT INTO vandelay.queued_bib_record (queue, bib_source, marc) + VALUES ( CURRVAL('vandelay.queue_id_seq'), 2, + '01532nam a22003138a 4500996CONS20140910210953.0070119s2009 nyua j 000 1 eng 200610044123297771397800608089 (trade bdg.)testGaiman, Neil.Blueberry girl 2 /written by Neil Gaiman.1st ed.New York :HarperCollinsPublishers,2009.TESTBR1StacksItem Category 1|EBOOK4674HV 1431 .S76 1990SC1001nonreferenceholdablecirculatingvisibleAvailableTESTBR1Stacks4675HV 1431 .S76 1990TESTSC1002nonreferenceholdablecirculatingvisibleAvailableTESTBR1StacksItem Category 1|EBOOK||Item Category 2|E-PROJECT MUSEHV 1431 .S76 1990SC3003nonreferenceholdablecirculatingvisibleAvailableTESTBR1StacksHV 1431 .S76 1990SC3004nonreferenceholdablecirculatingvisibleAvailable' + ); + +------------------- +-- Test the results +------------------- +SELECT is( + ( + SELECT count(*) + FROM vandelay.import_item + WHERE record = CURRVAL('vandelay.queued_record_id_seq') + AND stat_cat_data IS NOT NULL + ), + 2::bigint, + 'Stat cat data?' +); + +ROLLBACK;