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

(-)a/t/db_dependent/Auth_with_shibboleth.t (-3 / +33 lines)
Lines 20-26 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
use utf8;
21
use utf8;
22
22
23
use Test::More tests => 5;
23
use Test::More tests => 6;
24
use Test::MockModule;
24
use Test::MockModule;
25
use Test::Warn;
25
use Test::Warn;
26
use CGI qw(-utf8 );
26
use CGI qw(-utf8 );
Lines 32-37 use t::lib::TestBuilder; Link Here
32
32
33
use C4::Auth_with_shibboleth qw( shib_ok login_shib_url get_login_shib checkpw_shib );
33
use C4::Auth_with_shibboleth qw( shib_ok login_shib_url get_login_shib checkpw_shib );
34
use Koha::Database;
34
use Koha::Database;
35
use Koha::DateUtils qw( dt_from_string );
36
37
BEGIN {
38
    use_ok(
39
        'C4::Auth',
40
        qw( checkpw )
41
    );
42
}
35
43
36
my $schema = Koha::Database->new->schema;
44
my $schema = Koha::Database->new->schema;
37
$schema->storage->txn_begin;
45
$schema->storage->txn_begin;
Lines 156-162 subtest "get_login_shib tests" => sub { Link Here
156
164
157
subtest "checkpw_shib tests" => sub {
165
subtest "checkpw_shib tests" => sub {
158
166
159
    plan tests => 52;
167
    plan tests => 54;
160
168
161
    # Test borrower data
169
    # Test borrower data
162
    my $test_borrowers = [
170
    my $test_borrowers = [
Lines 288-293 subtest "checkpw_shib tests" => sub { Link Here
288
    is( $retuserid, undef );
296
    is( $retuserid, undef );
289
    is( $retpatron, undef );
297
    is( $retpatron, undef );
290
    $logger->info_is("No users with userid of martin found and autocreate is disabled", "Missing matchpoint warned to info");
298
    $logger->info_is("No users with userid of martin found and autocreate is disabled", "Missing matchpoint warned to info");
299
300
    # autocreate user from checkpw
301
    change_config( { autocreate => 1, welcome => 1 } );
302
    $shib_login      = 'test43210';
303
    $ENV{'uid'}      = 'test43210';
304
    $ENV{'sn'}       = "pika";
305
    $ENV{'exp'}      = "2017-01-01";
306
    $ENV{'cat'}      = $category->categorycode;
307
    $ENV{'add'}      = 'Address';
308
    $ENV{'city'}     = 'City';
309
    $ENV{'emailpro'} = 'me@myemail.com';
310
    $ENV{branchcode} = $library->branchcode;      # needed since T::D::C does no longer hides the FK constraint
311
312
    checkpw($shib_login);
313
    ok my $new_user_autocreated = $schema->resultset('Borrower')->search( { 'userid' => 'test43210' }, { rows => 1 } ),
314
        "new user found";
315
316
    my $rec_autocreated = $new_user_autocreated->next;
317
    is_deeply(
318
        [ map { $rec_autocreated->$_ } qw/updated_on/ ],
319
        [ dt_from_string()->ymd . ' ' . dt_from_string()->hms ],
320
        'updated_on correctly saved on newly created user'
321
    );
291
};
322
};
292
323
293
subtest 'get_uri' => sub {
324
subtest 'get_uri' => sub {
294
- 

Return to bug 36822