Bugzilla – Attachment 94496 Details for
Bug 23843
Make existing endpoints use Koha::Object(s)->to_api
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23843: (QA follow-up) Fix tests for funds
Bug-23843-QA-follow-up-Fix-tests-for-funds.patch (text/plain), 2.78 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-10-21 18:23:23 UTC
(
hide
)
Description:
Bug 23843: (QA follow-up) Fix tests for funds
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-10-21 18:23:23 UTC
Size:
2.78 KB
patch
obsolete
>From e2a01caf335f5231894ba4347ad103e01b52a05b Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 21 Oct 2019 15:18:32 -0300 >Subject: [PATCH] Bug 23843: (QA follow-up) Fix tests for funds > >Now that we use ->to_api all the object attributes are returned, so the >original tests that didn't follow the FKs would pass, and now they >don't. If there is no budget linked to the fund, it will return undef, >which is not accepted on the API (though it accepts not returning the >attribute). > >To test: >1. Run: > $ kshell > k$ prove t/db_dependent/api/v1/acquisitions_funds.t >=> SUCCESS: Tests pass! > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/api/v1/acquisitions_funds.t | 28 ++++++++++++---------- > 1 file changed, 16 insertions(+), 12 deletions(-) > >diff --git a/t/db_dependent/api/v1/acquisitions_funds.t b/t/db_dependent/api/v1/acquisitions_funds.t >index 910f6be8ce..307e6d2a1b 100644 >--- a/t/db_dependent/api/v1/acquisitions_funds.t >+++ b/t/db_dependent/api/v1/acquisitions_funds.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 14; >+use Test::More tests => 13; > use Test::Mojo; > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -51,14 +51,18 @@ my $unauth_password = 'thePassword123'; > $patron->set_password({ password => $unauth_password, skip_validation => 1 }); > my $unauth_userid = $patron->userid; > >-my $fund1 = { >- budget_code => 'ABCD', >- budget_amount => '123.132000', >- budget_name => 'Periodiques', >- budget_notes => 'This is a note', >-}; >-my $budget_id = AddBudget($fund1); >-isnt( $budget_id, undef, 'AddBudget does not returns undef' ); >+my $fund_name = 'Periodiques'; >+ >+my $fund = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Funds', >+ value => { >+ budget_amount => '123.132000', >+ budget_name => $fund_name, >+ budget_notes => 'This is a note' >+ } >+ } >+); > > $t->get_ok('/api/v1/acquisitions/funds') > ->status_is(401); >@@ -69,15 +73,15 @@ $t->get_ok('/api/v1/acquisitions/funds/?name=testFund') > $t->get_ok("//$unauth_userid:$unauth_password@/api/v1/acquisitions/funds") > ->status_is(403); > >-$t->get_ok("//$unauth_userid:$unauth_password@/api/v1/acquisitions/funds/?name=" . $fund1->{ budget_name }) >+$t->get_ok("//$unauth_userid:$unauth_password@/api/v1/acquisitions/funds?name=" . $fund_name) > ->status_is(403); > > $t->get_ok("//$userid:$password@/api/v1/acquisitions/funds") > ->status_is(200); > >-$t->get_ok("//$userid:$password@/api/v1/acquisitions/funds/?name=" . $fund1->{ budget_name }) >+$t->get_ok("//$userid:$password@/api/v1/acquisitions/funds?name=" . $fund_name) > ->status_is(200) >- ->json_like('/0/name' => qr/$fund1->{ budget_name }/); >+ ->json_like('/0/name' => qr/$fund_name/); > > $schema->storage->txn_rollback; > >-- >2.23.0
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 23843
:
94470
|
94471
|
94472
|
94473
|
94474
|
94475
|
94476
|
94477
|
94478
|
94496
|
94506
|
94507
|
94508
|
94509
|
94510
|
94511
|
94512
|
94513
|
94514
|
94587
|
94588
|
94589
|
94590
|
94591
|
94592
|
94593
|
94594
|
94595
|
94596
|
94619
|
94620
|
94621
|
94622
|
94623
|
94624
|
94625
|
94626
|
94627
|
94628