From f668201078a11fe06d9bb8e1c658648e7ed2be60 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 29 Jul 2016 11:34:06 -0400 Subject: [PATCH] LP#1588543: tests for verifying correct generated of record attributes This patch adds tests to verify that the expected set of record attributes are generated when a bib record is ingested. The tests serve a couple purposes: - verifying that changes to the record attribute ingest stored procedure don't have unexpected side-effects - validating record attribute definitions in the seed data Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- .../sql/Pg/t/lp1588543_marc_record_attributes.pg | 211 +++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/t/lp1588543_marc_record_attributes.pg diff --git a/Open-ILS/src/sql/Pg/t/lp1588543_marc_record_attributes.pg b/Open-ILS/src/sql/Pg/t/lp1588543_marc_record_attributes.pg new file mode 100644 index 0000000000..971da52c3c --- /dev/null +++ b/Open-ILS/src/sql/Pg/t/lp1588543_marc_record_attributes.pg @@ -0,0 +1,211 @@ +-- tests to verify that the expected record attributes are +-- parsed during record ingest; note that this is expected +-- to fluctuate as seed data for record attributes definitions +-- get updated. +BEGIN; + +SELECT plan(2); + +INSERT INTO biblio.record_entry (last_xact_id, marc) VALUES ( + 'marc-attr-test', + $record$ + 02137cam a2200457 a 4500 + ocn694080497 + OCoLC + 20160729104757.0 + 101217s2011 txu b 001 0 eng + + 2010053400 + + + DLC + eng + DLC + RCJ + CLU + YDXCP + BWX + YLS + CDX + ONA + OCLCF + OCLCO + OCL + OCLCQ + OCLCO + + + 9780735587786 + + + 0735587787 + + + 9780735587793 + (pbk. ; + teacher's manual) + + + 0735587795 + (pbk. ; + teacher's manual) + + + (OCoLC)694080497 + + + pcc + + + n-us--- + + + KF9619 + .C62 2011 + + + 345.73/05 + 22 + + + EQNX + + + Comprehensive criminal procedure / + Ronald Jay Allen [and others]. + + + 3rd ed. + + + Austin : + Wolters Kluwer Law & Business, + ©2011. + + + xxxvi, 1699 pages ; + 26 cm + + teacher's manual. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Aspen casebook series + + + Includes bibliographical references and index. + + + Introduction to the criminal justice "system" -- The idea of due process -- The right to counsel and other assistance -- The rise and fall of Boyd v. United States -- The Fourth Amendment -- The Fifth Amendment -- Complex investigations in the Fourth Amendment's shadow -- Bail and pretrial detention -- The charging decision -- Pretrial screening and the grand jury -- The scope of the prosecution -- Discovery and disclosure -- Guilty pleas and plea bargaining -- The jury and the criminal trial -- Sentencing -- Double jeopardy -- Appellate and collateral review. + + + Criminal procedure + United States. + + + Criminal procedure. + fast + (OCoLC)fst00883421 + + + United States. + fast + (OCoLC)fst01204155 + + + Casebooks. + fast + (OCoLC)fst01774238 + + + Casebooks. + lcgft + + + Allen, Ronald J. + (Ronald Jay), + 1948- + + + Aspen casebook series. + +$record$); + +SELECT cmp_ok( + (SELECT attrs FROM metabib.record_attr WHERE id=(SELECT CURRVAL('biblio.record_entry_id_seq'))), + '@>', + $attr$ + "conf"=>"0", + "cont"=>"b", + "ctry"=>"txu", + "fest"=>"0", + "ills"=>" ", + "indx"=>"1", + "cont1"=>"b", + "date1"=>"2011", + "date2"=>"9999", + "ills1"=>" ", + "audience"=>" ", + "cat_form"=>"a", + "language"=>"eng", + "lit_form"=>"0", + "bib_level"=>"m", + "item_lang"=>"eng", + "item_type"=>"a", + "media_type"=>"unmediated", + "pub_status"=>"s", + "icon_format"=>"book", + "carrier_type"=>"volume", + "content_type"=>"text", + "search_format"=>"book", + "mr_hold_format"=>"book" + $attr$, + 'all expected record attributes found' +); + +SELECT cmp_ok( + (SELECT attrs FROM metabib.record_attr WHERE id=(SELECT CURRVAL('biblio.record_entry_id_seq'))), + '<@', + $attr$ + "conf"=>"0", + "cont"=>"b", + "ctry"=>"txu", + "fest"=>"0", + "ills"=>" ", + "indx"=>"1", + "cont1"=>"b", + "date1"=>"2011", + "date2"=>"9999", + "ills1"=>" ", + "audience"=>" ", + "cat_form"=>"a", + "language"=>"eng", + "lit_form"=>"0", + "bib_level"=>"m", + "item_lang"=>"eng", + "item_type"=>"a", + "media_type"=>"unmediated", + "pub_status"=>"s", + "icon_format"=>"book", + "carrier_type"=>"volume", + "content_type"=>"text", + "search_format"=>"book", + "mr_hold_format"=>"book" + $attr$, + 'no extra record attributes found' +); + +ROLLBACK; -- 2.11.0