Bug 14144: Silence warnings t/db_dependent/Auth_with_ldap.t
Revisiting this bug, I noticed that C4::Context->config() was mocked poorly. I expanded the mock function a little and have quieted the test which seemed to be working in a broken manner before. TEST PLAN --------- 1) prove t/db_dependend/Auth_with_ldap.t -- shibboleth noise 2) apply this patch 3) prove t/db_dependend/Auth_with_ldap.t -- no noise 4) run koha qa test tools Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
cf705bdd0e
commit
b140c4b2fd
|
|
@ -270,37 +270,50 @@ subtest "search_method tests" => sub {
|
|||
|
||||
# Function that mocks the call to C4::Context->config(param)
|
||||
sub mockedC4Config {
|
||||
|
||||
my $class = shift;
|
||||
my $param = shift;
|
||||
|
||||
my %ldap_mapping = (
|
||||
firstname => { is => 'givenname' },
|
||||
surname => { is => 'sn' },
|
||||
address => { is => 'postaladdress' },
|
||||
city => { is => 'l' },
|
||||
zipcode => { is => 'postalcode' },
|
||||
branchcode => { is => 'branch' },
|
||||
userid => { is => 'uid' },
|
||||
password => { is => 'userpassword' },
|
||||
email => { is => 'mail' },
|
||||
categorycode => { is => 'employeetype' },
|
||||
phone => { is => 'telephonenumber' }
|
||||
);
|
||||
if ($param eq 'useshibboleth') {
|
||||
return 0;
|
||||
}
|
||||
elsif ($param eq 'ldapserver') {
|
||||
my %ldap_mapping = (
|
||||
firstname => { is => 'givenname' },
|
||||
surname => { is => 'sn' },
|
||||
address => { is => 'postaladdress' },
|
||||
city => { is => 'l' },
|
||||
zipcode => { is => 'postalcode' },
|
||||
branchcode => { is => 'branch' },
|
||||
userid => { is => 'uid' },
|
||||
password => { is => 'userpassword' },
|
||||
email => { is => 'mail' },
|
||||
categorycode => { is => 'employeetype' },
|
||||
phone => { is => 'telephonenumber' }
|
||||
);
|
||||
|
||||
my %ldap_config = (
|
||||
anonymous_bind => $anonymous_bind,
|
||||
auth_by_bind => $auth_by_bind,
|
||||
base => 'dc=metavore,dc=com',
|
||||
hostname => 'localhost',
|
||||
mapping => \%ldap_mapping,
|
||||
pass => 'metavore',
|
||||
principal_name => '%s@my_domain.com',
|
||||
replicate => $replicate,
|
||||
update => $update,
|
||||
user => 'cn=Manager,dc=metavore,dc=com'
|
||||
);
|
||||
|
||||
return \%ldap_config;
|
||||
my %ldap_config = (
|
||||
anonymous_bind => $anonymous_bind,
|
||||
auth_by_bind => $auth_by_bind,
|
||||
base => 'dc=metavore,dc=com',
|
||||
hostname => 'localhost',
|
||||
mapping => \%ldap_mapping,
|
||||
pass => 'metavore',
|
||||
principal_name => '%s@my_domain.com',
|
||||
replicate => $replicate,
|
||||
update => $update,
|
||||
user => 'cn=Manager,dc=metavore,dc=com'
|
||||
);
|
||||
return \%ldap_config;
|
||||
}
|
||||
elsif ($param =~ /(intranetdir|opachtdocs|intrahtdocs)/ ) {
|
||||
return '';
|
||||
}
|
||||
elsif (ref $class eq 'HASH') {
|
||||
return $class->{$param};
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
# Function that mocks the call to Net::LDAP
|
||||
|
|
|
|||
Loading…
Reference in New Issue