Bug 11401: QA followup - Make the tests pass
The configs in koha-conf.xml needed to be mocked. There was also a problem with how the NorwegianPatronDBEndpoint syspref was getting checked in the .pm. Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
1be9f1a0e7
commit
85255ef18f
2 changed files with 10 additions and 7 deletions
|
@ -79,7 +79,6 @@ our %EXPORT_TAGS = ( all => [qw(
|
||||||
Exporter::export_ok_tags('all');
|
Exporter::export_ok_tags('all');
|
||||||
|
|
||||||
my $nl_uri = 'http://lanekortet.no';
|
my $nl_uri = 'http://lanekortet.no';
|
||||||
my $nl_proxy = C4::Context->preference("NorwegianPatronDBEndpoint");
|
|
||||||
|
|
||||||
=head2 SOAP::Transport::HTTP::Client::get_basic_credentials
|
=head2 SOAP::Transport::HTTP::Client::get_basic_credentials
|
||||||
|
|
||||||
|
@ -156,7 +155,7 @@ sub NLSearch {
|
||||||
my $client = SOAP::Lite
|
my $client = SOAP::Lite
|
||||||
->on_action( sub { return '""';})
|
->on_action( sub { return '""';})
|
||||||
->uri( $nl_uri )
|
->uri( $nl_uri )
|
||||||
->proxy( $nl_proxy );
|
->proxy( C4::Context->preference("NorwegianPatronDBEndpoint") );
|
||||||
|
|
||||||
my $id = SOAP::Data->type('string');
|
my $id = SOAP::Data->type('string');
|
||||||
$id->name('identifikator');
|
$id->name('identifikator');
|
||||||
|
@ -236,7 +235,7 @@ sub NLSync {
|
||||||
my $client = SOAP::Lite
|
my $client = SOAP::Lite
|
||||||
->on_action( sub { return '""';})
|
->on_action( sub { return '""';})
|
||||||
->uri( $nl_uri )
|
->uri( $nl_uri )
|
||||||
->proxy( $nl_proxy );
|
->proxy( C4::Context->preference("NorwegianPatronDBEndpoint") );
|
||||||
|
|
||||||
my $cardnumber = SOAP::Data->name( 'lnr' => $patron->cardnumber );
|
my $cardnumber = SOAP::Data->name( 'lnr' => $patron->cardnumber );
|
||||||
|
|
||||||
|
@ -289,7 +288,7 @@ sub NLGetChanged {
|
||||||
my $client = SOAP::Lite
|
my $client = SOAP::Lite
|
||||||
->on_action( sub { return '""';})
|
->on_action( sub { return '""';})
|
||||||
->uri( $nl_uri )
|
->uri( $nl_uri )
|
||||||
->proxy( $nl_proxy );
|
->proxy( C4::Context->preference("NorwegianPatronDBEndpoint") );
|
||||||
|
|
||||||
my $from_string;
|
my $from_string;
|
||||||
if ( $from_arg && $from_arg ne '' ) {
|
if ( $from_arg && $from_arg ne '' ) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||||
|
|
||||||
use Modern::Perl;
|
use Modern::Perl;
|
||||||
use Test::More;
|
use Test::More tests => 73;
|
||||||
use Test::MockModule;
|
use Test::MockModule;
|
||||||
use t::lib::Mocks;
|
use t::lib::Mocks;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
@ -113,10 +113,16 @@ Relevant sysprefs:
|
||||||
|
|
||||||
=cut
|
=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('NorwegianPatronDBEnable', 0);
|
||||||
t::lib::Mocks::mock_preference('NorwegianPatronDBEndpoint', '');
|
t::lib::Mocks::mock_preference('NorwegianPatronDBEndpoint', '');
|
||||||
t::lib::Mocks::mock_preference('NorwegianPatronDBUsername', '');
|
t::lib::Mocks::mock_preference('NorwegianPatronDBUsername', '');
|
||||||
t::lib::Mocks::mock_preference('NorwegianPatronDBPassword', '');
|
t::lib::Mocks::mock_preference('NorwegianPatronDBPassword', '');
|
||||||
|
|
||||||
ok( my $result = NLCheckSysprefs(), 'call NLCheckSysprefs() ok' );
|
ok( my $result = NLCheckSysprefs(), 'call NLCheckSysprefs() ok' );
|
||||||
is( $result->{ 'error' }, 1, 'error detected' );
|
is( $result->{ 'error' }, 1, 'error detected' );
|
||||||
is( $result->{ 'nlenabled' }, 0, 'NL is not enabled' );
|
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_poster_returnert'}, 0, 'got 0 records' );
|
||||||
is( $res->{'antall_treff'}, 0, 'got 0 records' );
|
is( $res->{'antall_treff'}, 0, 'got 0 records' );
|
||||||
|
|
||||||
done_testing();
|
|
||||||
|
|
||||||
=head1 SAMPLE SOAP XML RESPONSES
|
=head1 SAMPLE SOAP XML RESPONSES
|
||||||
|
|
||||||
These responses can be gathered by setting "outputxml()" to true on the SOAP
|
These responses can be gathered by setting "outputxml()" to true on the SOAP
|
||||||
|
|
Loading…
Reference in a new issue