From dd6d53a5a3e0f4374b5771228e219856632012ea Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 14 Jun 2017 16:56:13 -0300 Subject: [PATCH] Bug 18807: Fix tests www/batch.t Several things are wrong here: 1. It assumes that import_record_id is the biblionumber => Wrong, it is only true when the DB is empty and that the 2 AI equal 1 2. The encoding in the template is 'UTF-8', not 'utf8', it leaded to "stage-marc-import.pl: marc21record.mrc: Unexpected charset UTF-8, expecting utf8" 3. We did not test that the biblio was correctly imported Test plan: Make sure the tests now pass. For the www tests you need to set the following env vars: KOHA_USER, KOHA_PASS, KOHA_INTRANET_URL and KOHA_OPAC_URL Signed-off-by: Lee Jamison Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart (cherry picked from commit 768c5758a2bb34876528e64edbb9d651942668c9) Signed-off-by: Fridolin Somers (cherry picked from commit 92fee49448f9bc68ad6884d5600bbba94caae547) Signed-off-by: Katrin Fischer --- t/db_dependent/www/batch.t | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/www/batch.t b/t/db_dependent/www/batch.t index 71fce09462..90e3bde8de 100644 --- a/t/db_dependent/www/batch.t +++ b/t/db_dependent/www/batch.t @@ -1,6 +1,7 @@ #!/usr/bin/perl # Copyright 2012 C & P Bibliography Services +# Copyright 2017 Koha Development Team # # This is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software @@ -19,7 +20,7 @@ use Modern::Perl; use utf8; -use Test::More tests => 24; +use Test::More tests => 26; use Test::WWW::Mechanize; use XML::Simple; use JSON; @@ -91,7 +92,7 @@ $agent->submit_form_ok( 'item_action' => 'always_add', 'matcher' => '', 'comments' => '', - 'encoding' => 'utf8', + 'encoding' => 'UTF-8', 'parse_items' => '1', 'runinbackground' => '1', 'record_type' => 'biblio' @@ -145,7 +146,7 @@ $agent->submit_form_ok( 'item_action' => 'always_add', 'matcher' => '1', 'comments' => '', - 'encoding' => 'utf8', + 'encoding' => 'UTF-8', 'parse_items' => '1', 'runinbackground' => '1', 'completedJobID' => $jobID, @@ -179,7 +180,6 @@ like( $jsonresponse->{ aaData }[0]->{ citation }, qr/$bookdescription/, 'found b is( $jsonresponse->{ aaData }[0]->{ status }, 'staged', 'record marked as staged' ); is( $jsonresponse->{ aaData }[0]->{ overlay_status }, 'no_match', 'record has no matches' ); -my $biblionumber = $jsonresponse->{ aaData }[0]->{ import_record_id }; # Back to the manage staged records page $agent->get($staged_records_uri); $agent->form_number(6); @@ -190,6 +190,14 @@ $agent->get("$intranet/cgi-bin/koha/tools/batch_records_ajax.pl?import_batch_id= $jsonresponse = decode_json $agent->content; is( $jsonresponse->{ aaData }[0]->{ status }, 'imported', 'record marked as imported' ); +my $biblionumber = $jsonresponse->{aaData}[0]->{matched}; + +$agent->get_ok( + "$intranet/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber", + 'getting imported bib' ); +$agent->content_contains( 'Details for ' . $bookdescription, + 'bib is imported' ); + $agent->get($staged_records_uri); $agent->form_number(5); $agent->click_ok( 'mainformsubmit', "revert import" ); -- 2.39.5