Bugzilla – Attachment 20034 Details for
Bug 10389
Share a list (part 2: accept the invitation)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10389: Add unit tests for AcceptShare and IsSharedList
Bug-10389-Add-unit-tests-for-AcceptShare-and-IsSha.patch (text/plain), 2.33 KB, created by
Marcel de Rooy
on 2013-08-01 10:13:29 UTC
(
hide
)
Description:
Bug 10389: Add unit tests for AcceptShare and IsSharedList
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2013-08-01 10:13:29 UTC
Size:
2.33 KB
patch
obsolete
>From b36cd9528fe9fd37746ce33ea5b9ef96a57d3d0c Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 1 Aug 2013 08:55:20 +0200 >Subject: [PATCH] Bug 10389: Add unit tests for AcceptShare and IsSharedList >Content-Type: text/plain; charset=utf-8 > >The first patch of bug 10389 adds two new routines to VirtualShelves.pm. >This patch adds unit tests for them. > >Test plan: >Run unit test t/db_dependent/VirtualShelves.t. Do all 95 tests pass? > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/VirtualShelves.t | 29 ++++++++++++++++++++++++++++- > 1 files changed, 28 insertions(+), 1 deletions(-) > >diff --git a/t/db_dependent/VirtualShelves.t b/t/db_dependent/VirtualShelves.t >index c2865b2..27bfd34 100755 >--- a/t/db_dependent/VirtualShelves.t >+++ b/t/db_dependent/VirtualShelves.t >@@ -5,7 +5,7 @@ > # Larger modifications by Jonathan Druart and Marcel de Rooy > > use Modern::Perl; >-use Test::More tests => 83; >+use Test::More tests => 95; > use MARC::Record; > > use C4::Biblio qw( AddBiblio DelBiblio ); >@@ -202,6 +202,33 @@ else { > is(1+$cnt2, $cnt3, "Added one new share record with invitekey"); > } > >+#----------------------- TEST AcceptShare -------------------------------------# >+ >+# test accepting a wrong key >+my $testkey= 'keyisgone9'; >+my $acctest="delete from virtualshelfshares where invitekey=?"; >+$dbh->do($acctest,undef,($testkey)); #just be sure it does not exist >+$acctest="select shelfnumber from virtualshelves"; >+my ($accshelf)= $dbh->selectrow_array($acctest); >+is(AcceptShare($accshelf,$testkey,$borrowers[0]),undef,'Did not accept invalid key'); >+ >+# test accepting a good key >+if( AddShare($accshelf,$testkey) && $borrowers[0] ) { >+ is(AcceptShare($accshelf, $testkey, $borrowers[0]),1,'Accepted share'); >+} >+else { #cannot accept if addshared failed somehow >+ ok(1, 'Skipped second AcceptShare test'); >+} >+ >+#----------------------- TEST IsSharedList ------------------------------------# >+ >+for my $i (0..9) { >+ my $sql="select count(*) from virtualshelfshares where shelfnumber=? and borrowernumber is not null"; >+ my $sh=$shelves[$i]->{number}; >+ my ($n)=$dbh->selectrow_array($sql,undef,($sh)); >+ is(IsSharedList($sh),$n? 1: '', "Checked IsSharedList for shelf $sh"); >+} >+ > #----------------TEST DelShelf & DelFromShelf functions------------------------# > > for my $i (0..9){ >-- >1.7.7.6
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10389
:
19602
|
20033
|
20034
|
20038