Lines 166-172
subtest "get_login_shib tests" => sub {
Link Here
|
166 |
|
166 |
|
167 |
## checkpw_shib |
167 |
## checkpw_shib |
168 |
subtest "checkpw_shib tests" => sub { |
168 |
subtest "checkpw_shib tests" => sub { |
169 |
plan tests => 21; |
169 |
plan tests => 24; |
170 |
|
170 |
|
171 |
my $shib_login; |
171 |
my $shib_login; |
172 |
my ( $retval, $retcard, $retuserid ); |
172 |
my ( $retval, $retcard, $retuserid ); |
Lines 174-181
subtest "checkpw_shib tests" => sub {
Link Here
|
174 |
# Setup Mock Database Data |
174 |
# Setup Mock Database Data |
175 |
fixtures_ok [ |
175 |
fixtures_ok [ |
176 |
'Borrower' => [ |
176 |
'Borrower' => [ |
177 |
[qw/cardnumber userid surname address city/], |
177 |
[qw/cardnumber userid surname address city email/], |
178 |
[qw/testcardnumber test1234 renvoize myaddress johnston/], |
178 |
[qw/testcardnumber test1234 renvoize myaddress johnston /], |
|
|
179 |
[qw/testcardnumber1 test12345 clamp1 myaddress quechee kid@clamp.io/], |
180 |
[qw/testcardnumber2 test123456 clamp2 myaddress quechee kid@clamp.io/], |
179 |
], |
181 |
], |
180 |
'Category' => [ [qw/categorycode default_privacy/], [qw/S never/], ] |
182 |
'Category' => [ [qw/categorycode default_privacy/], [qw/S never/], ] |
181 |
], |
183 |
], |
Lines 202-207
subtest "checkpw_shib tests" => sub {
Link Here
|
202 |
[], "bad user with no debug"; |
204 |
[], "bad user with no debug"; |
203 |
is( $retval, "0", "user not authenticated" ); |
205 |
is( $retval, "0", "user not authenticated" ); |
204 |
|
206 |
|
|
|
207 |
# duplicated matchpoint |
208 |
$matchpoint = 'email'; |
209 |
$mapping{'email'} = { is => 'email' }; |
210 |
$shib_login = 'kid@clamp.io'; |
211 |
warnings_are { |
212 |
( $retval, $retcard, $retuserid ) = checkpw_shib($shib_login); |
213 |
} |
214 |
[], "bad user with no debug"; |
215 |
is( $retval, "0", "user not authenticated if duplicated matchpoint" ); |
216 |
$C4::Auth_with_shibboleth::debug = '1'; |
217 |
warnings_are { |
218 |
( $retval, $retcard, $retuserid ) = checkpw_shib($shib_login); |
219 |
} |
220 |
[ |
221 |
q/checkpw_shib/, |
222 |
q/koha borrower field to match: email/, |
223 |
q/shibboleth attribute to match: email/, |
224 |
q/User Shibboleth-authenticated as: kid@clamp.io/, |
225 |
q/There are several users with email of kid@clamp.io, matchpoints must be unique/ |
226 |
], "duplicated matchpoint warned with debug"; |
227 |
$C4::Auth_with_shibboleth::debug = '0'; |
228 |
reset_config(); |
229 |
|
205 |
# autocreate user |
230 |
# autocreate user |
206 |
$autocreate = 1; |
231 |
$autocreate = 1; |
207 |
$shib_login = 'test4321'; |
232 |
$shib_login = 'test4321'; |
208 |
- |
|
|