@@ -, +, @@ --- Koha/NorwegianPatronDB.pm | 7 +++---- t/NorwegianPatronDB.t | 10 +++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) --- a/Koha/NorwegianPatronDB.pm +++ a/Koha/NorwegianPatronDB.pm @@ -79,7 +79,6 @@ our %EXPORT_TAGS = ( all => [qw( Exporter::export_ok_tags('all'); my $nl_uri = 'http://lanekortet.no'; -my $nl_proxy = C4::Context->preference("NorwegianPatronDBEndpoint"); =head2 SOAP::Transport::HTTP::Client::get_basic_credentials @@ -156,7 +155,7 @@ sub NLSearch { my $client = SOAP::Lite ->on_action( sub { return '""';}) ->uri( $nl_uri ) - ->proxy( $nl_proxy ); + ->proxy( C4::Context->preference("NorwegianPatronDBEndpoint") ); my $id = SOAP::Data->type('string'); $id->name('identifikator'); @@ -236,7 +235,7 @@ sub NLSync { my $client = SOAP::Lite ->on_action( sub { return '""';}) ->uri( $nl_uri ) - ->proxy( $nl_proxy ); + ->proxy( C4::Context->preference("NorwegianPatronDBEndpoint") ); my $cardnumber = SOAP::Data->name( 'lnr' => $patron->cardnumber ); @@ -289,7 +288,7 @@ sub NLGetChanged { my $client = SOAP::Lite ->on_action( sub { return '""';}) ->uri( $nl_uri ) - ->proxy( $nl_proxy ); + ->proxy( C4::Context->preference("NorwegianPatronDBEndpoint") ); my $from_string; if ( $from_arg && $from_arg ne '' ) { --- a/t/NorwegianPatronDB.t +++ a/t/NorwegianPatronDB.t @@ -16,7 +16,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More; +use Test::More tests => 73; use Test::MockModule; use t::lib::Mocks; use Data::Dumper; @@ -113,10 +113,16 @@ Relevant sysprefs: =cut +BEGIN { + t::lib::Mocks::mock_config('nlkey', 'key'); + t::lib::Mocks::mock_config('nlvendoruser', 'user'); + t::lib::Mocks::mock_config('nlvendorpass', 'pass'); +} t::lib::Mocks::mock_preference('NorwegianPatronDBEnable', 0); t::lib::Mocks::mock_preference('NorwegianPatronDBEndpoint', ''); t::lib::Mocks::mock_preference('NorwegianPatronDBUsername', ''); t::lib::Mocks::mock_preference('NorwegianPatronDBPassword', ''); + ok( my $result = NLCheckSysprefs(), 'call NLCheckSysprefs() ok' ); is( $result->{ 'error' }, 1, 'error detected' ); is( $result->{ 'nlenabled' }, 0, 'NL is not enabled' ); @@ -298,8 +304,6 @@ is( $res->{'melding'}, 'ingen treff', 'got "ingen treff"' ); is( $res->{'antall_poster_returnert'}, 0, 'got 0 records' ); is( $res->{'antall_treff'}, 0, 'got 0 records' ); -done_testing(); - =head1 SAMPLE SOAP XML RESPONSES These responses can be gathered by setting "outputxml()" to true on the SOAP --