Bugzilla – Attachment 70999 Details for
Bug 13990
ILS-DI LookupPatron Requries ID Type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13990: QA Followup - Add unit test coverage
Bug-13990-QA-Followup---Add-unit-test-coverage.patch (text/plain), 2.68 KB, created by
Mark Tompsett
on 2018-01-28 06:45:51 UTC
(
hide
)
Description:
Bug 13990: QA Followup - Add unit test coverage
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-01-28 06:45:51 UTC
Size:
2.68 KB
patch
obsolete
>From 558984f861bd1f654e83de2799a90ed6c318fceb Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Sun, 28 Jan 2018 01:18:54 -0500 >Subject: [PATCH] Bug 13990: QA Followup - Add unit test coverage > >prove t/db_dependent/ILSDI_Services.t > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > t/db_dependent/ILSDI_Services.t | 58 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 57 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index 7677db0..4ac83a0 100644 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::MockModule; > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -198,3 +198,59 @@ subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes > $schema->storage->txn_rollback; > }; > >+ >+subtest 'LookupPatron test' => sub { >+ >+ plan tests => 9; >+ >+ $schema->storage->txn_begin; >+ >+ $schema->resultset( 'Issue' )->delete_all; >+ $schema->resultset( 'Borrower' )->delete_all; >+ $schema->resultset( 'BorrowerAttribute' )->delete_all; >+ $schema->resultset( 'BorrowerAttributeType' )->delete_all; >+ $schema->resultset( 'Category' )->delete_all; >+ $schema->resultset( 'Item' )->delete_all; # 'Branch' deps. on this >+ $schema->resultset( 'Branch' )->delete_all; >+ >+ my $borrower = $builder->build({ >+ source => 'Borrower', >+ }); >+ >+ my $query = CGI->new(); >+ my $bad_result = C4::ILSDI::Services::LookupPatron($query); >+ is( $bad_result->{message}, 'PatronNotFound', 'No parameters' ); >+ >+ $query->delete_all(); >+ $query->param( 'id', $borrower->{firstname} ); >+ my $optional_result = C4::ILSDI::Services::LookupPatron($query); >+ is( >+ $optional_result->{id}, >+ $borrower->{borrowernumber}, >+ 'Valid Firstname only' >+ ); >+ >+ $query->delete_all(); >+ $query->param( 'id', 'ThereIsNoWayThatThisCouldPossiblyBeValid' ); >+ my $bad_optional_result = C4::ILSDI::Services::LookupPatron($query); >+ is( $bad_optional_result->{message}, 'PatronNotFound', 'Invalid ID' ); >+ >+ foreach my $id_type ( >+ 'cardnumber', >+ 'userid', >+ 'email', >+ 'borrowernumber', >+ 'surname', >+ 'firstname' >+ ) { >+ $query->delete_all(); >+ $query->param( 'id_type', $id_type ); >+ $query->param( 'id', $borrower->{$id_type} ); >+ my $result = C4::ILSDI::Services::LookupPatron($query); >+ is( $result->{'id'}, $borrower->{borrowernumber}, "Checking $id_type" ); >+ } >+ >+ # Cleanup >+ $schema->storage->txn_rollback; >+}; >+ >-- >2.1.4
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 13990
:
69004
|
70965
|
70966
|
70997
|
70998
|
70999
|
71000
|
71001
|
71002
|
71003
|
71004