add regression test for LP#1155329
authorGalen Charlton <gmc@esilibrary.com>
Fri, 12 Apr 2013 06:41:47 +0000 (02:41 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 24 Jun 2013 19:34:38 +0000 (15:34 -0400)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/sql/Pg/t/regress/lp1155329_use_id_for_tcn.pg [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/t/regress/lp1155329_use_id_for_tcn.pg b/Open-ILS/src/sql/Pg/t/regress/lp1155329_use_id_for_tcn.pg
new file mode 100644 (file)
index 0000000..fd55e09
--- /dev/null
@@ -0,0 +1,22 @@
+BEGIN;
+
+SELECT plan(2);
+
+UPDATE config.internal_flag SET enabled = FALSE WHERE name = 'cat.bib.use_id_for_tcn';
+INSERT INTO biblio.record_entry (marc, last_xact_id)
+VALUES ('<record xmlns="http://www.loc.gov/MARC21/slim"/>', 'test');
+
+SELECT matches((SELECT tcn_value FROM biblio.record_entry 
+               WHERE id = CURRVAL('biblio.record_entry_id_seq')),
+               '^AUTOGENERATED-',
+               'TCN is autogenerated when cat.bib.use_id_for_tcn is disabled');
+
+UPDATE config.internal_flag SET enabled = TRUE WHERE name = 'cat.bib.use_id_for_tcn';
+INSERT INTO biblio.record_entry (marc, last_xact_id)
+VALUES ('<record xmlns="http://www.loc.gov/MARC21/slim"/>', 'test');
+SELECT is((SELECT tcn_value FROM biblio.record_entry 
+          WHERE id = CURRVAL('biblio.record_entry_id_seq')),
+          (SELECT CURRVAL('biblio.record_entry_id_seq')::TEXT), 
+          'TCN equals BRE ID when cat.bib.use_id_for_tcn is enabled');
+
+ROLLBACK;