Bug 32353: Fix erm_agreements.t
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 23 Feb 2023 08:39:42 +0000 (09:39 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Thu, 23 Feb 2023 10:43:00 +0000 (07:43 -0300)
commite7d40b7a99c6ad8df8f91307560bb6021143c73f
tree8043c80d34318e4e88a2b51cd9871e0556e5f345
parentc500fd3c61f3ef5527c31d1904c3174f784452e2
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}%

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
t/db_dependent/api/v1/erm_agreements.t