d85f757ce7
For historical reasons the SIPServer and SIP modules have used an extra module path in addition to the standard Koha one. This has caused numerous irritants in attempting to set up scripts and basic tests. It does not help in attempting to modify or debug this code This patch changes the package value in the modules under the C4/SIP directory and makes calls to them use the full package name. Where the export mechanism was being short circuited routines have been explicitly exported and imported declarations of 'use ILS' when that module was not being used and which only generated warnings have been removed. As a lot of the changes affect lines where an object is instantiated with new. The opportunity has been taken to replace the ambiguous indirect syntax with the preferred direct call In intializing ILS the full path is added as this will not require any changes to existing configs. I suspect this feature is unused, and adds obfuscation rather than flexibility but have kept the feature as we need this change in order to rationalize and extend the testing of the server. The visible difference is that with the normal Koha PERL5LIB setting. Compilation of Modules under C4/SIP should be successful and not fail with unlocated modules, allowing developers to see any perl warnings All the SIP modules can now be run through the tests in t/00-load.t now except for SIPServer itself Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
80 lines
2.4 KiB
Perl
80 lines
2.4 KiB
Perl
#!/usr/bin/perl
|
|
#
|
|
# patron_status: check status of valid patron and invalid patron
|
|
|
|
use strict;
|
|
use warnings;
|
|
use FindBin qw($Bin);
|
|
use lib "$Bin";
|
|
|
|
use C4::SIP::Sip::Constants qw(:all);
|
|
use SIPtest qw($datepat $instid $currency :user1);
|
|
|
|
my @tests = (
|
|
$SIPtest::login_test,
|
|
$SIPtest::sc_status_test,
|
|
{ id => 'valid Patron Status',
|
|
msg => "2300120060101 084237AO$instid|AA$user_barcode|AD$user_pin|AC|",
|
|
pat => qr/^24 [ Y]{13}\d{3}$datepat/,
|
|
fields => [
|
|
$SIPtest::field_specs{(FID_INST_ID)},
|
|
$SIPtest::field_specs{(FID_SCREEN_MSG)},
|
|
$SIPtest::field_specs{(FID_PRINT_LINE)},
|
|
{ field => FID_PERSONAL_NAME,
|
|
pat => qr/^$user_fullname$/o,
|
|
required => 1, },
|
|
{ field => FID_PATRON_ID,
|
|
pat => qr/^$user_barcode/o,
|
|
required => 1, },
|
|
{ field => FID_VALID_PATRON,
|
|
pat => qr/^Y$/,
|
|
required => 0, },
|
|
{ field => FID_VALID_PATRON_PWD,
|
|
pat => qr/^Y$/,
|
|
required => 0, },
|
|
{ field => FID_CURRENCY,
|
|
pat => qr/^$currency$/io,
|
|
required => 0, },
|
|
{ field => FID_FEE_AMT,
|
|
pat => qr/^[0-9.]+$/,
|
|
required => 0, },
|
|
], },
|
|
{ id => 'invalid password Patron Status',
|
|
msg => "2300120060101 084237AO$instid|AA$user_barcode|AC|ADbadw|",
|
|
pat => qr/^24[ Y]{14}\d{3}$datepat/,
|
|
fields => [
|
|
{ field => FID_PERSONAL_NAME,
|
|
pat => qr/^$user_fullname$/o,
|
|
required => 1, },
|
|
{ field => FID_PATRON_ID,
|
|
pat => qr/^$user_barcode$/o,
|
|
required => 1, },
|
|
{ field => FID_INST_ID,
|
|
pat => qr/^$instid$/o,
|
|
required => 1, },
|
|
{ field => FID_VALID_PATRON_PWD,
|
|
pat => qr/^N$/,
|
|
required => 1, },
|
|
{ field => FID_VALID_PATRON,
|
|
pat => qr/^Y$/,
|
|
required => 1, },
|
|
], },
|
|
{ id => 'invalid Patron Status',
|
|
msg => "2300120060101 084237AO$instid|AAwshakespeare|AC|",
|
|
pat => qr/^24Y[ Y]{13}\d{3}$datepat/,
|
|
fields => [
|
|
{ field => FID_PERSONAL_NAME,
|
|
pat => qr/^$/,
|
|
required => 1, },
|
|
{ field => FID_PATRON_ID,
|
|
pat => qr/^wshakespeare$/,
|
|
required => 1, },
|
|
{ field => FID_INST_ID,
|
|
pat => qr/^$instid$/o,
|
|
required => 1, },
|
|
], },
|
|
);
|
|
|
|
SIPtest::run_sip_tests(@tests);
|
|
|
|
1;
|