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)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 27 Feb 2023 13:32:29 +0000 (13:32 +0000)
commit2d5bdbfa33348af53dc073cfcacd09e296b4773c
treef100f3117b074faa6c2280a036f7819166974c5d
parentb5a4badd6d84d330d25fe3d9320b75446fcbec38
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>
(cherry picked from commit e7d40b7a99c6ad8df8f91307560bb6021143c73f)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
t/db_dependent/api/v1/erm_agreements.t