|
Lines 62-68
subtest 'Testing Patron Status Request V2' => sub {
Link Here
|
| 62 |
subtest 'Testing Patron Info Request V2' => sub { |
62 |
subtest 'Testing Patron Info Request V2' => sub { |
| 63 |
my $schema = Koha::Database->new->schema; |
63 |
my $schema = Koha::Database->new->schema; |
| 64 |
$schema->storage->txn_begin; |
64 |
$schema->storage->txn_begin; |
| 65 |
plan tests => 24; |
65 |
plan tests => 32; |
| 66 |
$C4::SIP::Sip::protocol_version = 2; |
66 |
$C4::SIP::Sip::protocol_version = 2; |
| 67 |
test_request_patron_info_v2(); |
67 |
test_request_patron_info_v2(); |
| 68 |
$schema->storage->txn_rollback; |
68 |
$schema->storage->txn_rollback; |
|
Lines 706-720
sub test_request_patron_info_v2 {
Link Here
|
| 706 |
$respcode = substr( $response, 0, 2 ); |
706 |
$respcode = substr( $response, 0, 2 ); |
| 707 |
check_field( $respcode, $response, FID_PERSONAL_NAME, 'X' . $patron2->{surname} . 'Y', 'Check customized patron name' ); |
707 |
check_field( $respcode, $response, FID_PERSONAL_NAME, 'X' . $patron2->{surname} . 'Y', 'Check customized patron name' ); |
| 708 |
|
708 |
|
|
|
709 |
# Test hide_fields |
| 709 |
undef $response; |
710 |
undef $response; |
| 710 |
$server->{account}->{hide_fields} = "BD,BE,BF,PB"; |
711 |
$server->{account}->{hide_fields} = join( ",", FID_HOME_ADDR, FID_EMAIL, FID_HOME_PHONE, FID_PATRON_BIRTHDATE ); |
| 711 |
$msg->handle_patron_info( $server ); |
712 |
$msg->handle_patron_info( $server ); |
| 712 |
$respcode = substr( $response, 0, 2 ); |
713 |
$respcode = substr( $response, 0, 2 ); |
| 713 |
check_field( $respcode, $response, FID_HOME_ADDR, undef, 'Home address successfully stripped from response' ); |
714 |
check_field( $respcode, $response, FID_HOME_ADDR, undef, 'Home address successfully stripped from response' ); |
| 714 |
check_field( $respcode, $response, FID_EMAIL, undef, 'Email address successfully stripped from response' ); |
715 |
check_field( $respcode, $response, FID_EMAIL, undef, 'Email address successfully stripped from response' ); |
| 715 |
check_field( $respcode, $response, FID_HOME_PHONE, undef, 'Home phone successfully stripped from response' ); |
716 |
check_field( $respcode, $response, FID_HOME_PHONE, undef, 'Home phone successfully stripped from response' ); |
| 716 |
check_field( $respcode, $response, FID_PATRON_BIRTHDATE, undef, 'Date of birth successfully stripped from response' ); |
717 |
check_field( $respcode, $response, FID_PATRON_BIRTHDATE, undef, 'Date of birth successfully stripped from response' ); |
| 717 |
$server->{account}->{hide_fields} = ""; |
718 |
delete $server->{account}->{hide_fields}; |
|
|
719 |
|
| 720 |
# Test allow_fields |
| 721 |
undef $response; |
| 722 |
$server->{account}->{allow_fields} = join( ",", FID_EMAIL, FID_HOME_PHONE ); |
| 723 |
$msg->handle_patron_info( $server ); |
| 724 |
$respcode = substr( $response, 0, 2 ); |
| 725 |
check_field( $respcode, $response, FID_HOME_ADDR, undef, 'Home address successfully stripped from response' ); |
| 726 |
check_field( $respcode, $response, FID_EMAIL, $patron2->{email}, 'Email address successfully retained in response' ); |
| 727 |
check_field( $respcode, $response, FID_HOME_PHONE, $patron2->{phone}, 'Home phone successfully retained in from response' ); |
| 728 |
check_field( $respcode, $response, FID_PATRON_BIRTHDATE, undef, 'Date of birth successfully stripped from response' ); |
| 729 |
delete $server->{account}->{allow_fields}; |
| 730 |
|
| 731 |
# Test hide_fields should take precedence over allow_fields |
| 732 |
undef $response; |
| 733 |
$server->{account}->{hide_fields} = join( ",", FID_HOME_ADDR, FID_EMAIL, FID_PATRON_BIRTHDATE ); |
| 734 |
$server->{account}->{allow_fields} = join( ",", FID_EMAIL, FID_HOME_PHONE ); |
| 735 |
$msg->handle_patron_info( $server ); |
| 736 |
$respcode = substr( $response, 0, 2 ); |
| 737 |
check_field( $respcode, $response, FID_HOME_ADDR, undef, 'Home address successfully stripped from response' ); |
| 738 |
check_field( $respcode, $response, FID_EMAIL, undef, 'Email address successfully stripped from response' ); |
| 739 |
check_field( $respcode, $response, FID_HOME_PHONE, $patron2->{phone}, 'Home phone successfully retained in from response' ); |
| 740 |
check_field( $respcode, $response, FID_PATRON_BIRTHDATE, undef, 'Date of birth successfully stripped from response' ); |
| 741 |
delete $server->{account}->{hide_fields}; |
| 742 |
delete $server->{account}->{allow_fields}; |
| 718 |
|
743 |
|
| 719 |
# Check empty password and verify CQ again |
744 |
# Check empty password and verify CQ again |
| 720 |
$siprequest = PATRON_INFO. 'engYYYYMMDDZZZZHHMMSS'.'Y '. |
745 |
$siprequest = PATRON_INFO. 'engYYYYMMDDZZZZHHMMSS'.'Y '. |
| 721 |
- |
|
|