Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 33; |
22 |
use Test::More tests => 34; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
use Test::Warn; |
24 |
use Test::Warn; |
25 |
use Time::Fake; |
25 |
use Time::Fake; |
Lines 1359-1364
subtest 'password expiration tests' => sub {
Link Here
|
1359 |
my $category = $builder->build_object({ class => 'Koha::Patron::Categories', value => { |
1359 |
my $category = $builder->build_object({ class => 'Koha::Patron::Categories', value => { |
1360 |
password_expiry_days => 10, |
1360 |
password_expiry_days => 10, |
1361 |
require_strong_password => 0, |
1361 |
require_strong_password => 0, |
|
|
1362 |
force_password_reset_when_set_by_staff => 0, |
1362 |
} |
1363 |
} |
1363 |
}); |
1364 |
}); |
1364 |
my $patron = $builder->build_object({ class=> 'Koha::Patrons', value => { |
1365 |
my $patron = $builder->build_object({ class=> 'Koha::Patrons', value => { |
Lines 1445-1450
subtest 'password expiration tests' => sub {
Link Here
|
1445 |
|
1446 |
|
1446 |
}; |
1447 |
}; |
1447 |
|
1448 |
|
|
|
1449 |
subtest 'force_password_reset_when_set_by_staff tests' => sub { |
1450 |
plan tests => 3; |
1451 |
|
1452 |
$schema->storage->txn_begin; |
1453 |
|
1454 |
my $category = $builder->build_object({ |
1455 |
class => 'Koha::Patron::Categories', |
1456 |
value => { |
1457 |
force_password_reset_when_set_by_staff => 1, |
1458 |
require_strong_password => 0, |
1459 |
} |
1460 |
}); |
1461 |
|
1462 |
my $patron = $builder->build_object({ |
1463 |
class => 'Koha::Patrons', |
1464 |
value => { |
1465 |
categorycode => $category->categorycode, |
1466 |
password => 'hats' |
1467 |
} |
1468 |
}); |
1469 |
|
1470 |
$patron->delete()->store()->discard_changes(); |
1471 |
is($patron->password_expired, 1, "Patron forced into changing password, password expired."); |
1472 |
|
1473 |
$patron->category->force_password_reset_when_set_by_staff(0)->store(); |
1474 |
$patron->delete()->store()->discard_changes(); |
1475 |
is($patron->password_expired, 0, "Patron not forced into changing password, password not expired."); |
1476 |
|
1477 |
$patron->category->force_password_reset_when_set_by_staff(1)->store(); |
1478 |
t::lib::Mocks::mock_preference('PatronSelfRegistrationDefaultCategory', $patron->categorycode); |
1479 |
$patron->delete()->store()->discard_changes(); |
1480 |
is($patron->password_expired, 0, "Patron forced into changing password but patron is self registered, password not expired."); |
1481 |
|
1482 |
$schema->storage->txn_rollback; |
1483 |
}; |
1484 |
|
1448 |
subtest 'safe_to_delete() tests' => sub { |
1485 |
subtest 'safe_to_delete() tests' => sub { |
1449 |
|
1486 |
|
1450 |
plan tests => 17; |
1487 |
plan tests => 17; |