Bug 34893: Add unit tests
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (cherry picked from commit 29782174570a331c1b9f1ac8196ce06364f8f691) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
4ebb9246cf
commit
04be28f856
|
|
@ -926,3 +926,50 @@ subtest 'GetAvailability itemcallnumber' => sub {
|
|||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
subtest 'Bug 34893: ILS-DI can return the wrong patron for AuthenticatePatron' => sub {
|
||||
|
||||
plan tests => 2;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $plain_password = 'tomasito';
|
||||
|
||||
$builder->build({
|
||||
source => 'Borrower',
|
||||
value => {
|
||||
cardnumber => undef,
|
||||
}
|
||||
});
|
||||
|
||||
my $borrower0 = $builder->build({
|
||||
source => 'Borrower',
|
||||
value => {
|
||||
cardnumber => "cardnumber1",
|
||||
userid => undef,
|
||||
password => Koha::AuthUtils::hash_password( $plain_password ),
|
||||
lastseen => "2001-01-01 12:34:56"
|
||||
}
|
||||
});
|
||||
|
||||
my $borrower = $builder->build({
|
||||
source => 'Borrower',
|
||||
value => {
|
||||
cardnumber => "cardnumber2",
|
||||
userid => undef,
|
||||
password => Koha::AuthUtils::hash_password( $plain_password ),
|
||||
lastseen => "2001-01-01 12:34:56"
|
||||
}
|
||||
});
|
||||
|
||||
my $query = CGI->new;
|
||||
$query->param( 'username', $borrower->{cardnumber});
|
||||
$query->param( 'password', $plain_password);
|
||||
|
||||
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} });
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue