View | Details | Raw Unified | Return to bug 28630
Collapse All | Expand All

(-)a/t/db_dependent/ILSDI_Services.t (-4 / +5 lines)
Lines 23-28 use Test::More tests => 10; Link Here
23
use Test::MockModule;
23
use Test::MockModule;
24
use t::lib::Mocks;
24
use t::lib::Mocks;
25
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
26
use t::lib::Dates;
26
27
27
use C4::Items qw( ModItemTransfer );
28
use C4::Items qw( ModItemTransfer );
28
use C4::Circulation qw( AddIssue );
29
use C4::Circulation qw( AddIssue );
Lines 58-64 subtest 'AuthenticatePatron test' => sub { Link Here
58
        value  => {
59
        value  => {
59
            cardnumber => undef,
60
            cardnumber => undef,
60
            password => Koha::AuthUtils::hash_password( $plain_password ),
61
            password => Koha::AuthUtils::hash_password( $plain_password ),
61
            lastseen => "2001-01-01"
62
            lastseen => "2001-01-01 12:34:56"
62
        }
63
        }
63
    });
64
    });
64
65
Lines 71-77 subtest 'AuthenticatePatron test' => sub { Link Here
71
    is( $reply->{id}, $borrower->{borrowernumber}, "userid and password - Patron authenticated" );
72
    is( $reply->{id}, $borrower->{borrowernumber}, "userid and password - Patron authenticated" );
72
    is( $reply->{code}, undef, "Error code undef");
73
    is( $reply->{code}, undef, "Error code undef");
73
    my $seen_patron = Koha::Patrons->find({ borrowernumber => $reply->{id} });
74
    my $seen_patron = Koha::Patrons->find({ borrowernumber => $reply->{id} });
74
    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');
75
    is( $seen_patron->lastseen(), '2001-01-01 12:34:56','Last seen not updated if not tracking patrons');
75
76
76
    $query->param('password','ilsdi-passworD');
77
    $query->param('password','ilsdi-passworD');
77
    $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
78
    $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
Lines 87-96 subtest 'AuthenticatePatron test' => sub { Link Here
87
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' );
88
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' );
88
    $query->param( 'username', uc( $borrower->{userid} ));
89
    $query->param( 'username', uc( $borrower->{userid} ));
89
    $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
90
    $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
91
    my $now = dt_from_string;
90
    is( $reply->{id}, $borrower->{borrowernumber}, "userid is not case sensitive - Patron authenticated" );
92
    is( $reply->{id}, $borrower->{borrowernumber}, "userid is not case sensitive - Patron authenticated" );
91
    is( $reply->{code}, undef, "Error code undef");
93
    is( $reply->{code}, undef, "Error code undef");
92
    $seen_patron = Koha::Patrons->find({ borrowernumber => $reply->{id} });
94
    $seen_patron = Koha::Patrons->find({ borrowernumber => $reply->{id} });
93
    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');
95
    is( t::lib::Dates::compare( $seen_patron->lastseen, $now), 0, 'Last seen updated to today if tracking patrons' );
94
96
95
    $query->param( 'username', $borrower->{cardnumber} );
97
    $query->param( 'username', $borrower->{cardnumber} );
96
    $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
98
    $reply = C4::ILSDI::Services::AuthenticatePatron( $query );
97
- 

Return to bug 28630