Bugzilla – Attachment 122491 Details for
Bug 28630
ILSDI::AuthenticatePatron should set borrowers.lastseen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28630: Add unit tests
Bug-28630-Add-unit-tests.patch (text/plain), 2.99 KB, created by
Andrew Fuerste-Henry
on 2021-06-29 13:07:55 UTC
(
hide
)
Description:
Bug 28630: Add unit tests
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2021-06-29 13:07:55 UTC
Size:
2.99 KB
patch
obsolete
>From f971dc1b0335fd5ea9687a6581091aca2a44b951 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 25 Jun 2021 10:33:18 +0100 >Subject: [PATCH] Bug 28630: Add unit tests > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > t/db_dependent/ILSDI_Services.t | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index c3be5cea94..17b7850ee0 100755 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -28,6 +28,7 @@ use C4::Items qw( ModItemTransfer ); > use C4::Circulation; > > use Koha::AuthUtils; >+use Koha::DateUtils; > > BEGIN { > use_ok('C4::ILSDI::Services'); >@@ -39,7 +40,7 @@ my $builder = t::lib::TestBuilder->new; > > subtest 'AuthenticatePatron test' => sub { > >- plan tests => 14; >+ plan tests => 16; > > $schema->storage->txn_begin; > >@@ -56,7 +57,8 @@ subtest 'AuthenticatePatron test' => sub { > source => 'Borrower', > value => { > cardnumber => undef, >- password => Koha::AuthUtils::hash_password( $plain_password ) >+ password => Koha::AuthUtils::hash_password( $plain_password ), >+ lastseen => "2001-01-01" > } > }); > >@@ -64,9 +66,12 @@ subtest 'AuthenticatePatron test' => sub { > $query->param( 'username', $borrower->{userid}); > $query->param( 'password', $plain_password); > >+ t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '' ); > my $reply = C4::ILSDI::Services::AuthenticatePatron( $query ); > is( $reply->{id}, $borrower->{borrowernumber}, "userid and password - Patron authenticated" ); > is( $reply->{code}, undef, "Error code undef"); >+ my $seen_patron = Koha::Patrons->find({ borrowernumber => $reply->{id} }); >+ is( output_pref({str => $seen_patron->lastseen(), dateonly => 1}), output_pref({str => '2001-01-01', dateonly => 1}),'Last seen not updated if not tracking patrons'); > > $query->param('password','ilsdi-passworD'); > $reply = C4::ILSDI::Services::AuthenticatePatron( $query ); >@@ -79,10 +84,13 @@ subtest 'AuthenticatePatron test' => sub { > is( $reply->{code}, 'PatronNotFound', "non-existing userid - PatronNotFound" ); > is( $reply->{id}, undef, "id undef"); > >+ t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' ); > $query->param( 'username', uc( $borrower->{userid} )); > $reply = C4::ILSDI::Services::AuthenticatePatron( $query ); > is( $reply->{id}, $borrower->{borrowernumber}, "userid is not case sensitive - Patron authenticated" ); > is( $reply->{code}, undef, "Error code undef"); >+ $seen_patron = Koha::Patrons->find({ borrowernumber => $reply->{id} }); >+ is( output_pref({str => $seen_patron->lastseen(), dateonly => 1}), output_pref({dt => dt_from_string(), dateonly => 1}),'Last seen updated to today if tracking patrons'); > > $query->param( 'username', $borrower->{cardnumber} ); > $reply = C4::ILSDI::Services::AuthenticatePatron( $query ); >-- >2.20.1
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 28630
:
122421
|
122422
|
122476
|
122477
|
122478
|
122490
|
122491
|
122492
|
122544
|
122545
|
122546
|
123448
|
123449
|
123450
|
123454