Bugzilla – Attachment 147191 Details for
Bug 32353
reserves.item_group_id should be undefined in tests by default
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32353: Fix erm_agreements.t
Bug-32353-Fix-ermagreementst.patch (text/plain), 3.37 KB, created by
Jonathan Druart
on 2023-02-23 08:42:57 UTC
(
hide
)
Description:
Bug 32353: Fix erm_agreements.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-02-23 08:42:57 UTC
Size:
3.37 KB
patch
obsolete
>From 8a8278571ebf175abfeff74f0a5f035574b04282 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 23 Feb 2023 09:39:42 +0100 >Subject: [PATCH] Bug 32353: Fix erm_agreements.t > >Agreement.vendor_id has a default value defined in TestBuilder, but here >we were assuming there was one. >We should then generate it and pass the value when building the >agreement objects. > >The failure was: >koha_1 | # Failed test '200 OK' >koha_1 | # at t/db_dependent/api/v1/erm_agreements.t line 95. >koha_1 | # got: '400' >koha_1 | # expected: '200' >koha_1 | >koha_1 | # Failed test 'exact match for JSON Pointer ""' >koha_1 | # at t/db_dependent/api/v1/erm_agreements.t line 95. >koha_1 | # Structures begin differing at: >koha_1 | # $got = HASH(0x55cde781a480) >koha_1 | # $expected = ARRAY(0x55cde75af9c8) >koha_1 | # Looks like you failed 2 tests of 32. > >400 because we were calling >http://localhost:8081/api/v1/erm/agreements?vendor_id=' >which returns {"errors":[{"message":"Expected integer - got string.","path":"\/vendor_id"}],"status":400}% >--- > t/db_dependent/api/v1/erm_agreements.t | 23 +++++++++++++++++------ > 1 file changed, 17 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/api/v1/erm_agreements.t b/t/db_dependent/api/v1/erm_agreements.t >index d5f2bc1207d..5dc0517a677 100755 >--- a/t/db_dependent/api/v1/erm_agreements.t >+++ b/t/db_dependent/api/v1/erm_agreements.t >@@ -65,8 +65,13 @@ subtest 'list() tests' => sub { > $t->get_ok("//$userid:$password@/api/v1/erm/agreements")->status_is(200) > ->json_is( [] ); > >- my $agreement = >- $builder->build_object( { class => 'Koha::ERM::Agreements' } ); >+ my $vendor_1 = $builder->build_object({ class => 'Koha::Acquisition::Booksellers' }); >+ my $agreement = $builder->build_object( >+ { >+ class => 'Koha::ERM::Agreements', >+ value => { vendor_id => $vendor_1->id }, >+ } >+ ); > > # One agreement created, should get returned > $t->get_ok("//$userid:$password@/api/v1/erm/agreements")->status_is(200) >@@ -75,11 +80,17 @@ subtest 'list() tests' => sub { > my $another_agreement = $builder->build_object( > { > class => 'Koha::ERM::Agreements', >- value => { vendor_id => $agreement->vendor_id } >+ value => { vendor_id => $vendor_1->id } >+ } >+ ); >+ >+ my $vendor_2 = $builder->build_object({ class => 'Koha::Acquisition::Booksellers' }); >+ my $agreement_with_another_vendor_id = $builder->build_object( >+ { >+ class => 'Koha::ERM::Agreements', >+ value => { vendor_id => $vendor_2->id }, > } > ); >- my $agreement_with_another_vendor_id = >- $builder->build_object( { class => 'Koha::ERM::Agreements' } ); > > # Two agreements created, they should both be returned > $t->get_ok("//$userid:$password@/api/v1/erm/agreements")->status_is(200) >@@ -93,7 +104,7 @@ subtest 'list() tests' => sub { > > # Filtering works, two agreements sharing vendor_id > $t->get_ok( "//$userid:$password@/api/v1/erm/agreements?vendor_id=" >- . $agreement->vendor_id )->status_is(200) >+ . $vendor_1->id )->status_is(200) > ->json_is( [ $agreement->to_api, $another_agreement->to_api ] ); > > # Attempt to search by name like 'ko' >-- >2.25.1
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 32353
:
144253
|
144254
|
144255
|
144279
|
144957
|
144958
|
146516
|
146517
| 147191