|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 5; |
20 |
use Test::More tests => 6; |
| 21 |
|
21 |
|
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
|
Lines 64-66
subtest 'Public Allowlist' => sub {
Link Here
|
| 64 |
is( $input->{surname}, 'test surname', 'surname preserved' ); |
64 |
is( $input->{surname}, 'test surname', 'surname preserved' ); |
| 65 |
is( $input->{flags}, undef, 'flags filtered' ); |
65 |
is( $input->{flags}, undef, 'flags filtered' ); |
| 66 |
}; |
66 |
}; |
| 67 |
- |
67 |
|
|
|
68 |
subtest 'additional_deny_list' => sub { |
| 69 |
plan tests => 10; |
| 70 |
|
| 71 |
my $input = { firstname => 'test firstname', surname => 'test surname' }; |
| 72 |
my $allowlist = Koha::Patron::Allowlist::Public->new(); |
| 73 |
|
| 74 |
$allowlist->apply({ |
| 75 |
input => $input, |
| 76 |
additional_deny_list => [], |
| 77 |
}); |
| 78 |
|
| 79 |
is( $input->{firstname}, 'test firstname', 'firstname preserved' ); |
| 80 |
is( $input->{surname}, 'test surname', 'surname filtered' ); |
| 81 |
is( $input->{flags}, undef, 'flags filtered' ); |
| 82 |
|
| 83 |
$allowlist->apply({ |
| 84 |
input => $input, |
| 85 |
additional_deny_list => ['not_here'], |
| 86 |
}); |
| 87 |
|
| 88 |
is( $input->{firstname}, 'test firstname', 'firstname preserved' ); |
| 89 |
is( $input->{surname}, 'test surname', 'surname filtered' ); |
| 90 |
is( $input->{flags}, undef, 'flags filtered' ); |
| 91 |
|
| 92 |
warning_like { |
| 93 |
$allowlist->apply({ |
| 94 |
input => $input, |
| 95 |
additional_deny_list => ['surname'], |
| 96 |
}); |
| 97 |
} |
| 98 |
qr{Forbidden - Tried to modify 'surname' with 'test surname' from}; |
| 99 |
|
| 100 |
is( $input->{firstname}, 'test firstname', 'firstname preserved' ); |
| 101 |
is( $input->{surname}, undef, 'surname filtered' ); |
| 102 |
is( $input->{flags}, undef, 'flags filtered' ); |
| 103 |
|
| 104 |
}; |