Lines 21-27
Link Here
|
21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
22 |
|
22 |
|
23 |
use Modern::Perl; |
23 |
use Modern::Perl; |
24 |
use Test::More tests => 10; |
24 |
use Test::More tests => 11; |
|
|
25 |
use Test::Exception; |
25 |
use Test::MockObject; |
26 |
use Test::MockObject; |
26 |
use Test::MockModule; |
27 |
use Test::MockModule; |
27 |
use Test::Warn; |
28 |
use Test::Warn; |
Lines 337-342
subtest 'Patron info summary > 5 should not crash server' => sub {
Link Here
|
337 |
$schema->storage->txn_rollback; |
338 |
$schema->storage->txn_rollback; |
338 |
}; |
339 |
}; |
339 |
|
340 |
|
|
|
341 |
subtest 'SC status tests' => sub { |
342 |
|
343 |
my $schema = Koha::Database->new->schema; |
344 |
$schema->storage->txn_begin; |
345 |
|
346 |
plan tests => 2; |
347 |
|
348 |
my $builder = t::lib::TestBuilder->new(); |
349 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
350 |
my $sip_user = $builder->build_object({ class => "Koha::Patrons" }); |
351 |
|
352 |
my ( $response, $findpatron ); |
353 |
my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); |
354 |
my $mockILS = $mocks->{ils}; |
355 |
$mockILS->mock( 'checkout_ok', sub {1} ); |
356 |
$mockILS->mock( 'checkin_ok', sub {1} ); |
357 |
$mockILS->mock( 'status_update_ok', sub {1} ); |
358 |
$mockILS->mock( 'offline_ok', sub {1} ); |
359 |
$mockILS->mock( 'supports', sub {1} ); |
360 |
my $server = Test::MockObject->new(); |
361 |
$server->mock( 'get_timeout', sub {'100'}); |
362 |
$server->{ils} = $mockILS; |
363 |
$server->{sip_username} = $sip_user->userid; |
364 |
$server->{account} = {}; |
365 |
$server->{policy} = { renewal =>1,retries=>'000'}; |
366 |
|
367 |
my $siprequest = SC_STATUS . '0' . '030' . '2.00'; |
368 |
my $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); |
369 |
$msg->handle_sc_status( $server ); |
370 |
|
371 |
like( $response, qr/98YYYYYY100000[0-9 ]{19}.00AO|BXYYYYYYYYYYYYYYYY|/, 'At least we got a response.' ); |
372 |
|
373 |
$sip_user->delete; |
374 |
|
375 |
dies_ok{ $msg->handle_sc_status( $server ) } ,"Dies if sip user cannot be found"; |
376 |
|
377 |
}; |
378 |
|
340 |
# Here is room for some more subtests |
379 |
# Here is room for some more subtests |
341 |
|
380 |
|
342 |
# END of main code |
381 |
# END of main code |
343 |
- |
|
|