Bug 36822: Shibboleth - Add tests
prove t/db_dependent/Auth_with_shibboleth.t Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
7e336006c2
commit
01d149b48a
|
|
@ -20,7 +20,7 @@
|
|||
use Modern::Perl;
|
||||
use utf8;
|
||||
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 6;
|
||||
use Test::MockModule;
|
||||
use Test::Warn;
|
||||
use CGI qw(-utf8 );
|
||||
|
|
@ -32,6 +32,14 @@ use t::lib::TestBuilder;
|
|||
|
||||
use C4::Auth_with_shibboleth qw( shib_ok login_shib_url get_login_shib checkpw_shib );
|
||||
use Koha::Database;
|
||||
use Koha::DateUtils qw( dt_from_string );
|
||||
|
||||
BEGIN {
|
||||
use_ok(
|
||||
'C4::Auth',
|
||||
qw( checkpw )
|
||||
);
|
||||
}
|
||||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
|
|
@ -156,7 +164,7 @@ subtest "get_login_shib tests" => sub {
|
|||
|
||||
subtest "checkpw_shib tests" => sub {
|
||||
|
||||
plan tests => 52;
|
||||
plan tests => 54;
|
||||
|
||||
# Test borrower data
|
||||
my $test_borrowers = [
|
||||
|
|
@ -288,6 +296,29 @@ subtest "checkpw_shib tests" => sub {
|
|||
is( $retuserid, undef );
|
||||
is( $retpatron, undef );
|
||||
$logger->info_is("No users with userid of martin found and autocreate is disabled", "Missing matchpoint warned to info");
|
||||
|
||||
# autocreate user from checkpw
|
||||
change_config( { autocreate => 1, welcome => 1 } );
|
||||
$shib_login = 'test43210';
|
||||
$ENV{'uid'} = 'test43210';
|
||||
$ENV{'sn'} = "pika";
|
||||
$ENV{'exp'} = "2017-01-01";
|
||||
$ENV{'cat'} = $category->categorycode;
|
||||
$ENV{'add'} = 'Address';
|
||||
$ENV{'city'} = 'City';
|
||||
$ENV{'emailpro'} = 'me@myemail.com';
|
||||
$ENV{branchcode} = $library->branchcode; # needed since T::D::C does no longer hides the FK constraint
|
||||
|
||||
checkpw($shib_login);
|
||||
ok my $new_user_autocreated = $schema->resultset('Borrower')->search( { 'userid' => 'test43210' }, { rows => 1 } ),
|
||||
"new user found";
|
||||
|
||||
my $rec_autocreated = $new_user_autocreated->next;
|
||||
is_deeply(
|
||||
[ map { $rec_autocreated->$_ } qw/updated_on/ ],
|
||||
[ dt_from_string()->ymd . ' ' . dt_from_string()->hms ],
|
||||
'updated_on correctly saved on newly created user'
|
||||
);
|
||||
};
|
||||
|
||||
subtest 'get_uri' => sub {
|
||||
|
|
|
|||
Loading…
Reference in New Issue