Bugzilla – Attachment 156884 Details for
Bug 24401
REST API: Check-in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24401: Unit tests
Bug-24401-Unit-tests.patch (text/plain), 2.62 KB, created by
Aleisha Amohia
on 2023-10-12 01:40:01 UTC
(
hide
)
Description:
Bug 24401: Unit tests
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2023-10-12 01:40:01 UTC
Size:
2.62 KB
patch
obsolete
>From e93c07b9fa40c09891fe7532f569b07640e2bc23 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 12 Oct 2023 01:35:25 +0000 >Subject: [PATCH] Bug 24401: Unit tests > >--- > t/db_dependent/api/v1/checkouts.t | 57 ++++++++++++++++++++++++++++++- > 1 file changed, 56 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/checkouts.t b/t/db_dependent/api/v1/checkouts.t >index cd62c00fde5..7fc7d6ae1db 100755 >--- a/t/db_dependent/api/v1/checkouts.t >+++ b/t/db_dependent/api/v1/checkouts.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 105; >+use Test::More tests => 106; > use Test::MockModule; > use Test::Mojo; > use t::lib::Mocks; >@@ -515,3 +515,58 @@ subtest 'add checkout' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'check in (return)' => sub { >+ >+ plan tests => 8; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { flags => 2 } >+ } >+ ); >+ my $password = 'thePassword000'; >+ $patron->set_password( { password => $password, skip_validation => 1 } ); >+ >+ my $patron_id = $patron->borrowernumber; >+ my $user_id = $patron->userid; >+ >+ my $item1 = $builder->build_sample_item; >+ my $item1_id = $item1->id; >+ >+ my $branchcode = $item1->homebranch; >+ my $wrong_branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; >+ >+ my $wrong_checkout = $builder->build_object( >+ { >+ class => 'Koha::Old::Checkouts', >+ value => { itemnumber => $item1_id, branchcode => $branchcode, borrowernumber => $patron_id } >+ } >+ ); >+ my $wrong_checkout_id = $wrong_checkout->id; >+ >+ my $checkout = $builder->build_object( >+ { >+ class => 'Koha::Checkouts', >+ value => { >+ itemnumber => $item1_id, branchcode => $branchcode, borrowernumber => $patron_id, note => undef, >+ notedate => undef, noteseen => undef >+ } >+ } >+ ); >+ my $checkout_id = $checkout->id; >+ >+ $t->post_ok("//$user_id:$password@/api/v1/checkouts/$wrong_checkout_id/checkin/$branchcode")->status_is(400); >+ >+ $t->post_ok("//$user_id:$password@/api/v1/checkouts/$checkout_id/checkin")->status_is(404); >+ >+ t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'homebranch' ); >+ $t->post_ok("//$user_id:$password@/api/v1/checkouts/$checkout_id/checkin/$wrong_branchcode")->status_is(403); >+ >+ $t->post_ok("//$user_id:$password@/api/v1/checkouts/$checkout_id/checkin/$branchcode")->status_is(201); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24401
:
151109
|
151181
|
151182
|
151183
|
151184
|
152717
|
154428
|
154429
|
154430
|
154431
| 156884 |
156885