|
Lines 270-306
subtest "search_method tests" => sub {
Link Here
|
| 270 |
|
270 |
|
| 271 |
# Function that mocks the call to C4::Context->config(param) |
271 |
# Function that mocks the call to C4::Context->config(param) |
| 272 |
sub mockedC4Config { |
272 |
sub mockedC4Config { |
| 273 |
|
273 |
my $class = shift; |
| 274 |
my $param = shift; |
274 |
my $param = shift; |
| 275 |
|
275 |
|
| 276 |
my %ldap_mapping = ( |
276 |
if ($param eq 'useshibboleth') { |
| 277 |
firstname => { is => 'givenname' }, |
277 |
return 0; |
| 278 |
surname => { is => 'sn' }, |
278 |
} |
| 279 |
address => { is => 'postaladdress' }, |
279 |
elsif ($param eq 'ldapserver') { |
| 280 |
city => { is => 'l' }, |
280 |
my %ldap_mapping = ( |
| 281 |
zipcode => { is => 'postalcode' }, |
281 |
firstname => { is => 'givenname' }, |
| 282 |
branchcode => { is => 'branch' }, |
282 |
surname => { is => 'sn' }, |
| 283 |
userid => { is => 'uid' }, |
283 |
address => { is => 'postaladdress' }, |
| 284 |
password => { is => 'userpassword' }, |
284 |
city => { is => 'l' }, |
| 285 |
email => { is => 'mail' }, |
285 |
zipcode => { is => 'postalcode' }, |
| 286 |
categorycode => { is => 'employeetype' }, |
286 |
branchcode => { is => 'branch' }, |
| 287 |
phone => { is => 'telephonenumber' } |
287 |
userid => { is => 'uid' }, |
| 288 |
); |
288 |
password => { is => 'userpassword' }, |
| 289 |
|
289 |
email => { is => 'mail' }, |
| 290 |
my %ldap_config = ( |
290 |
categorycode => { is => 'employeetype' }, |
| 291 |
anonymous_bind => $anonymous_bind, |
291 |
phone => { is => 'telephonenumber' } |
| 292 |
auth_by_bind => $auth_by_bind, |
292 |
); |
| 293 |
base => 'dc=metavore,dc=com', |
293 |
|
| 294 |
hostname => 'localhost', |
294 |
my %ldap_config = ( |
| 295 |
mapping => \%ldap_mapping, |
295 |
anonymous_bind => $anonymous_bind, |
| 296 |
pass => 'metavore', |
296 |
auth_by_bind => $auth_by_bind, |
| 297 |
principal_name => '%s@my_domain.com', |
297 |
base => 'dc=metavore,dc=com', |
| 298 |
replicate => $replicate, |
298 |
hostname => 'localhost', |
| 299 |
update => $update, |
299 |
mapping => \%ldap_mapping, |
| 300 |
user => 'cn=Manager,dc=metavore,dc=com' |
300 |
pass => 'metavore', |
| 301 |
); |
301 |
principal_name => '%s@my_domain.com', |
| 302 |
|
302 |
replicate => $replicate, |
| 303 |
return \%ldap_config; |
303 |
update => $update, |
|
|
304 |
user => 'cn=Manager,dc=metavore,dc=com' |
| 305 |
); |
| 306 |
return \%ldap_config; |
| 307 |
} |
| 308 |
elsif ($param =~ /(intranetdir|opachtdocs|intrahtdocs)/ ) { |
| 309 |
return ''; |
| 310 |
} |
| 311 |
elsif (ref $class eq 'HASH') { |
| 312 |
return $class->{$param}; |
| 313 |
} |
| 314 |
else { |
| 315 |
return; |
| 316 |
} |
| 304 |
}; |
317 |
}; |
| 305 |
|
318 |
|
| 306 |
# Function that mocks the call to Net::LDAP |
319 |
# Function that mocks the call to Net::LDAP |
| 307 |
- |
|
|