[open-ils-commits] [GIT] Evergreen ILS branch master updated. dc6e1e86cae4b223ce22031c94b3a756f280fe0b

Evergreen Git git at git.evergreen-ils.org
Sun Jan 19 14:40:42 EST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  dc6e1e86cae4b223ce22031c94b3a756f280fe0b (commit)
      from  5c565f6b5203c841664b1b508a23551bc549863b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dc6e1e86cae4b223ce22031c94b3a756f280fe0b
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Oct 10 16:05:57 2013 -0400

    New live test for fetching and update bre/MARC data
    
    Fetch a record, test the title, add a new subfield, update the record,
    and test that the new subfield survived the update.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/perlmods/live_t/06-bib_rec_fetch_update.t b/Open-ILS/src/perlmods/live_t/06-bib_rec_fetch_update.t
new file mode 100644
index 0000000..9668f8f
--- /dev/null
+++ b/Open-ILS/src/perlmods/live_t/06-bib_rec_fetch_update.t
@@ -0,0 +1,83 @@
+#!perl
+
+use Test::More tests => 6;
+
+diag("Fetches and updates a bib records MARC data");
+
+use strict; use warnings;
+
+use MARC::Record;                                                              
+use MARC::Field;
+use MARC::File::XML (BinaryEncoding => 'UTF-8');
+use OpenILS::Utils::TestUtils;
+use OpenILS::Utils::Normalize qw/clean_marc/;
+my $script = OpenILS::Utils::TestUtils->new();
+
+my $test_record = 1;
+my $test_title = 'La canzone italiana del Novecento :';
+my $test_note = "Live Test Note";
+
+# we need auth to access protected APIs
+$script->authenticate({
+    username => 'admin',
+    password => 'demo123',
+    type => 'staff'});
+
+my $authtoken = $script->authtoken;
+ok($authtoken, 'Have an authtoken');
+ 
+my $ses = $script->session('open-ils.cstore');
+my $req = $ses->request(
+    'open-ils.cstore.direct.biblio.record_entry.retrieve', 
+    $test_record);
+
+my $bre;
+if (my $resp = $req->recv) {
+    if ($bre = $resp->content) {
+        is(
+            ref $bre,
+            'Fieldmapper::biblio::record_entry',
+            'open-ils.cstore.direct.biblio.record_entry.retrieve '.
+                'returned a bre object'
+        );
+    }
+}
+
+my $marc = MARC::Record->new_from_xml($bre->marc);
+is(
+    $marc->subfield('245', 'a'),
+    $test_title,
+    'subfield(245, a) returned expected value'
+);
+
+my $field = MARC::Field->new('999','','','a' => $test_note);
+$marc->append_fields($field);
+
+is(
+    $marc->subfield('999', 'a'),
+    $test_note, 
+    'subfield(999, a) has correct note'
+);
+
+$req = $script->session('open-ils.cat')->request(
+    'open-ils.cat.biblio.record.xml.update',
+    $authtoken, $bre->id, clean_marc($marc->as_xml));
+
+if (my $resp = $req->recv) {
+    if ($bre = $resp->content) {
+        is(
+            ref $bre,
+            'Fieldmapper::biblio::record_entry',
+            'open-ils.cat.biblio.record.xml.update returned a bre object'
+        );
+
+        my $marc = MARC::Record->new_from_xml($bre->marc);
+        
+        is(
+            $marc->subfield('999', 'a'),
+            $test_note, 
+            'Updated MARC subfield(999, a) has correct note'
+        );
+    }
+}
+

-----------------------------------------------------------------------

Summary of changes:
 .../src/perlmods/live_t/06-bib_rec_fetch_update.t  |   83 ++++++++++++++++++++
 1 files changed, 83 insertions(+), 0 deletions(-)
 create mode 100644 Open-ILS/src/perlmods/live_t/06-bib_rec_fetch_update.t


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list