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

(-)a/t/db_dependent/Auth.t (-2 / +4 lines)
Lines 127-133 subtest 'no_set_userenv parameter tests' => sub { Link Here
127
    plan tests => 7;
127
    plan tests => 7;
128
128
129
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
129
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
130
    my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
130
    my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {min_password_length => undef, require_strong_password => undef} } );
131
    my $patron  = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $category->categorycode } } );
131
    my $password = 'password';
132
    my $password = 'password';
132
133
133
    t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
134
    t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
Lines 149-155 subtest 'checkpw lockout tests' => sub { Link Here
149
    plan tests => 5;
150
    plan tests => 5;
150
151
151
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
152
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
152
    my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
153
    my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => {min_password_length => undef, require_strong_password => undef} } );
154
    my $patron  = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $category->categorycode } } );
153
    my $password = 'password';
155
    my $password = 'password';
154
    t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
156
    t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
155
    t::lib::Mocks::mock_preference( 'FailedLoginAttempts', 1 );
157
    t::lib::Mocks::mock_preference( 'FailedLoginAttempts', 1 );
(-)a/t/db_dependent/Koha/Patron.t (-1 / +1 lines)
Lines 191-194 subtest 'to_api() tests' => sub { Link Here
191
    is( $patron_json->{algo}, 'algo' );
191
    is( $patron_json->{algo}, 'algo' );
192
192
193
    $schema->storage->txn_rollback;
193
    $schema->storage->txn_rollback;
194
};
194
};
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +4 lines)
Lines 1723-1729 subtest '->store' => sub { Link Here
1723
    my $print_error = $schema->storage->dbh->{PrintError};
1723
    my $print_error = $schema->storage->dbh->{PrintError};
1724
    $schema->storage->dbh->{PrintError} = 0; ; # FIXME This does not longer work - because of the transaction in Koha::Patron->store?
1724
    $schema->storage->dbh->{PrintError} = 0; ; # FIXME This does not longer work - because of the transaction in Koha::Patron->store?
1725
1725
1726
    my $patron_1 = $builder->build_object({class=> 'Koha::Patrons'});
1726
    my $category = $builder->build_object({class=> 'Koha::Patron::Categories', value=>{min_password_length => undef, require_strong_password => undef}});
1727
    my $patron_1 = $builder->build_object({class=> 'Koha::Patrons', value=> { categorycode => $category->categorycode}});
1727
    my $patron_2 = $builder->build_object({class=> 'Koha::Patrons'});
1728
    my $patron_2 = $builder->build_object({class=> 'Koha::Patrons'});
1728
1729
1729
    throws_ok
1730
    throws_ok
Lines 1776-1782 subtest '->set_password' => sub { Link Here
1776
1777
1777
    $schema->storage->txn_begin;
1778
    $schema->storage->txn_begin;
1778
1779
1779
    my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { login_attempts => 3 } } );
1780
    my $category = $builder->build_object( { class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef } } );
1781
    my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { login_attempts => 3, categorycode => $category->categorycode } } );
1780
1782
1781
    # Disable logging password changes for this tests
1783
    # Disable logging password changes for this tests
1782
    t::lib::Mocks::mock_preference( 'BorrowersLog', 0 );
1784
    t::lib::Mocks::mock_preference( 'BorrowersLog', 0 );
(-)a/t/db_dependent/Koha/Patrons/Import.t (-2 / +2 lines)
Lines 443-450 subtest 'test_import_with_password_overwrite' => sub { Link Here
443
443
444
    #Setup our info
444
    #Setup our info
445
    my $branchcode = $builder->build({ source => "Branch"})->{branchcode};
445
    my $branchcode = $builder->build({ source => "Branch"})->{branchcode};
446
    my $categorycode = $builder->build({ source => "Category", value => { category_type => 'A'  } })->{categorycode};
446
    my $categorycode = $builder->build({ source => "Category", value => { category_type => 'A', min_password_length => undef, require_strong_password => undef  } })->{categorycode};
447
    my $staff_categorycode = $builder->build({ source => "Category", value => { category_type => 'S'  } })->{categorycode};
447
    my $staff_categorycode = $builder->build({ source => "Category", value => { category_type => 'S', min_password_length => undef, require_strong_password => undef  } })->{categorycode};
448
    my $csv_headers  = 'surname,userid,branchcode,categorycode,password';
448
    my $csv_headers  = 'surname,userid,branchcode,categorycode,password';
449
    my $csv_password = "Worrell,ErnestP,$branchcode,$categorycode,Ernest1";
449
    my $csv_password = "Worrell,ErnestP,$branchcode,$categorycode,Ernest1";
450
    my $csv_password_change = "Worrell,ErnestP,$branchcode,$categorycode,Vern1";
450
    my $csv_password_change = "Worrell,ErnestP,$branchcode,$categorycode,Vern1";
(-)a/t/db_dependent/Koha/Plugins/Patron.t (-1 / +1 lines)
Lines 54-60 subtest 'check_password hook tests' => sub { Link Here
54
    my $plugin = Koha::Plugin::Test->new->enable;
54
    my $plugin = Koha::Plugin::Test->new->enable;
55
55
56
    my $library  = $builder->build( { source => 'Branch' } );
56
    my $library  = $builder->build( { source => 'Branch' } );
57
    my $category = $builder->build( { source => 'Category' } );
57
    my $category = $builder->build( { source => 'Category', value => {min_password_length => undef, require_strong_password => undef} } );
58
    my $patron   = Koha::Patron->new(
58
    my $patron   = Koha::Patron->new(
59
        {
59
        {
60
            cardnumber   => 'test_cn_1',
60
            cardnumber   => 'test_cn_1',
(-)a/t/db_dependent/Search/History.t (-1 / +2 lines)
Lines 368-374 my $schema = Koha::Database->schema; Link Here
368
my $builder = t::lib::TestBuilder->new;
368
my $builder = t::lib::TestBuilder->new;
369
369
370
# Borrower Creation
370
# Borrower Creation
371
our $patron = $builder->build( { source => 'Borrower' } );
371
my $category = $builder->build( { source => 'Category', value => {min_password_length => undef, require_strong_password => undef} } );
372
our $patron = $builder->build( { source => 'Borrower', value => { categorycode => $category->{categorycode} } } );
372
t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
373
t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
373
Koha::Patrons->find( $patron->{borrowernumber} )->set_password({ password => 'password' });
374
Koha::Patrons->find( $patron->{borrowernumber} )->set_password({ password => 'password' });
374
375
(-)a/t/db_dependent/api/v1/auth_basic.t (-2 / +4 lines)
Lines 38-45 subtest 'success tests' => sub { Link Here
38
38
39
    my $password = 'AbcdEFG123';
39
    my $password = 'AbcdEFG123';
40
40
41
    my $category = $builder->build_object({ class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef }});
41
    my $patron = $builder->build_object(
42
    my $patron = $builder->build_object(
42
        { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 2**4 } } );
43
        { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 2**4, categorycode => $category->categorycode } } );
43
    $patron->set_password({ password => $password });
44
    $patron->set_password({ password => $password });
44
    my $userid = $patron->userid;
45
    my $userid = $patron->userid;
45
46
Lines 69-76 subtest 'failure tests' => sub { Link Here
69
70
70
    t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
71
    t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
71
72
73
    my $category = $builder->build_object({ class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef }});
72
    my $patron = $builder->build_object(
74
    my $patron = $builder->build_object(
73
        { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 2**4 } } );
75
        { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 2**4, categorycode => $category->categorycode } } );
74
    $patron->set_password({ password => $password });
76
    $patron->set_password({ password => $password });
75
    my $userid = $patron->userid;
77
    my $userid = $patron->userid;
76
78
(-)a/t/db_dependent/api/v1/checkouts.t (-2 / +4 lines)
Lines 41-57 $schema->storage->txn_begin; Link Here
41
41
42
my $dbh = C4::Context->dbh;
42
my $dbh = C4::Context->dbh;
43
43
44
my $category = $builder->build_object({class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef } });
44
my $librarian = $builder->build_object({
45
my $librarian = $builder->build_object({
45
    class => 'Koha::Patrons',
46
    class => 'Koha::Patrons',
46
    value => { flags => 2 }
47
    value => { flags => 2, categorycode => $category->categorycode }
47
});
48
});
48
my $password = 'thePassword123';
49
my $password = 'thePassword123';
49
$librarian->set_password({ password => $password, skip_validation => 1 });
50
$librarian->set_password({ password => $password, skip_validation => 1 });
50
my $userid = $librarian->userid;
51
my $userid = $librarian->userid;
51
52
53
$category = $builder->build_object({class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef } });
52
my $patron = $builder->build_object({
54
my $patron = $builder->build_object({
53
    class => 'Koha::Patrons',
55
    class => 'Koha::Patrons',
54
    value => { flags => 0 }
56
    value => { flags => 0, categorycode => $category->categorycode }
55
});
57
});
56
my $unauth_password = 'thePassword000';
58
my $unauth_password = 'thePassword000';
57
$patron->set_password({ password => $unauth_password, skip_validattion => 1 });
59
$patron->set_password({ password => $unauth_password, skip_validattion => 1 });
(-)a/t/db_dependent/api/v1/patrons_password.t (-1 / +2 lines)
Lines 237-246 sub create_user_and_session { Link Here
237
    my ( $args ) = @_;
237
    my ( $args ) = @_;
238
    my $flags = ( $args->{authorized} ) ? 16 : 0;
238
    my $flags = ( $args->{authorized} ) ? 16 : 0;
239
239
240
    my $category = $builder->build_object({ class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef}});
240
    my $user = $builder->build_object(
241
    my $user = $builder->build_object(
241
        {
242
        {
242
            class => 'Koha::Patrons',
243
            class => 'Koha::Patrons',
243
            value => { flags => $flags }
244
            value => { flags => $flags, categorycode => $category->categorycode }
244
        }
245
        }
245
    );
246
    );
246
247
(-)a/t/db_dependent/selenium/authentication.t (-2 / +4 lines)
Lines 48-54 SKIP: { Link Here
48
        like( $driver->get_title, qr(Log in to Koha), 'Hitting the main page should redirect to the login form');
48
        like( $driver->get_title, qr(Log in to Koha), 'Hitting the main page should redirect to the login form');
49
49
50
        my $password = Koha::AuthUtils::generate_password();
50
        my $password = Koha::AuthUtils::generate_password();
51
        my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 0 }});
51
        my $category = $builder->build_object({class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef } });
52
        my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 0, categorycode => $category->categorycode }});
52
        t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
53
        t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
53
        $patron->set_password({ password => $password });
54
        $patron->set_password({ password => $password });
54
55
Lines 82-88 SKIP: { Link Here
82
        like( $driver->get_title, qr(Koha online catalog), 'Hitting the main page should not redirect to the login form');
83
        like( $driver->get_title, qr(Koha online catalog), 'Hitting the main page should not redirect to the login form');
83
84
84
        my $password = Koha::AuthUtils::generate_password();
85
        my $password = Koha::AuthUtils::generate_password();
85
        my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 0 }});
86
        my $category = $builder->build_object({class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef } });
87
        my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 0, categorycode => $category->categorycode }});
86
        t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
88
        t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
87
        $patron->set_password({ password => $password });
89
        $patron->set_password({ password => $password });
88
90
(-)a/t/db_dependent/selenium/regressions.t (-3 / +4 lines)
Lines 52-59 our @cleanup; Link Here
52
subtest 'OPAC - borrowernumber and branchcode as html attributes' => sub {
52
subtest 'OPAC - borrowernumber and branchcode as html attributes' => sub {
53
    plan tests => 2;
53
    plan tests => 2;
54
54
55
    my $category = $builder->build_object({class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef } });
55
    my $patron = $builder->build_object(
56
    my $patron = $builder->build_object(
56
        { class => 'Koha::Patrons', value => { flags => 1 } } );
57
        { class => 'Koha::Patrons', value => { flags => 1, categorycode => $category->categorycode } } );
57
    my $password = Koha::AuthUtils::generate_password();
58
    my $password = Koha::AuthUtils::generate_password();
58
    t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
59
    t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );
59
    $patron->set_password({ password => $password });
60
    $patron->set_password({ password => $password });
Lines 197-203 subtest 'Display circulation table correctly' => sub { Link Here
197
subtest 'XSS vulnerabilities in pagination' => sub {
198
subtest 'XSS vulnerabilities in pagination' => sub {
198
    plan tests => 3;
199
    plan tests => 3;
199
200
200
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
201
    my $category = $builder->build_object({class => 'Koha::Patron::Categories', value => { min_password_length => undef, require_strong_password => undef } });
202
    my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { categorycode => $category->categorycode } });
201
    for ( 1 .. 30 ) { # We want the pagination to be displayed
203
    for ( 1 .. 30 ) { # We want the pagination to be displayed
202
        push @cleanup, $builder->build_object(
204
        push @cleanup, $builder->build_object(
203
            {
205
            {
204
- 

Return to bug 23816