From 442f5a3a627297f9f34b2a89b923634985cd5bfa Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 1 Jun 2016 15:34:56 +0200 Subject: [PATCH] Bug 16610: [QA Follow-up] Add a test Content-Type: text/plain; charset=utf-8 To verify the original patch, this test shows that before applying it the Patron Info request did not return CQ==N for an empty password. Note that the Patron Status did btw. After applying the original patch, the test passes for patron info as well as status. Signed-off-by: Marcel de Rooy --- t/db_dependent/SIP/Message.t | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t index 07c5204..088829a 100755 --- a/t/db_dependent/SIP/Message.t +++ b/t/db_dependent/SIP/Message.t @@ -62,7 +62,7 @@ $branchcode = $branch->{branchcode}; # START testing subtest 'Testing Patron Status Request V2' => sub { $schema->storage->txn_begin; - plan tests => 12; + plan tests => 13; $C4::SIP::Sip::protocol_version = 2; test_request_patron_status_v2(); $schema->storage->txn_rollback; @@ -70,7 +70,7 @@ subtest 'Testing Patron Status Request V2' => sub { subtest 'Testing Patron Info Request V2' => sub { $schema->storage->txn_begin; - plan tests => 15; + plan tests => 16; $C4::SIP::Sip::protocol_version = 2; test_request_patron_info_v2(); $schema->storage->txn_rollback; @@ -123,6 +123,17 @@ sub test_request_patron_status_v2 { $respcode = substr( $response, 0, 2 ); check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'N', 'Verified code CQ for wrong pw' ); + # Check empty password and verify CQ again + $siprequest = PATRON_STATUS_REQ. 'engYYYYMMDDZZZZHHMMSS'. + FID_INST_ID. $branchcode. '|'. + FID_PATRON_ID. $card1. '|'. + FID_PATRON_PWD. '|'; + $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); + undef $response; + $msg->handle_patron_status( $server ); + $respcode = substr( $response, 0, 2 ); + check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'N', 'code CQ should be N for empty AD' ); + # Finally, we send a wrong card number and check AE, BL # This is done by removing the new patron first $schema->resultset('Borrower')->search({ cardnumber => $card1 })->delete; @@ -175,6 +186,17 @@ sub test_request_patron_info_v2 { # No check for custom fields here (unofficial PB, PC and PI) check_field( $respcode, $response, FID_SCREEN_MSG, '.+', 'We have a screen msg', 'regex' ); + # Check empty password and verify CQ again + $siprequest = PATRON_INFO. 'engYYYYMMDDZZZZHHMMSS'.'Y '. + FID_INST_ID. $branchcode. '|'. + FID_PATRON_ID. $card. '|'. + FID_PATRON_PWD. '|'; + $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); + undef $response; + $msg->handle_patron_info( $server ); + $respcode = substr( $response, 0, 2 ); + check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'N', 'code CQ should be N for empty AD' ); + # Finally, we send a wrong card number $schema->resultset('Borrower')->search({ cardnumber => $card })->delete; undef $findpatron; -- 1.7.10.4