From f03ab789249dfd8949803ff417586388ae0cfd84 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 2 Feb 2022 09:49:57 -0300 Subject: [PATCH] Bug 29759: (follow-up) Fix api/v1/article_requests.t This patch makes the tests set debit_id to undef instead of random data. This way tests don't break when $article_request->cancel is invoked and a refund is tried. To test: 1. Run: $ kshell k$ prove t/db_dependent/Letters/TemplateToolkit.t => FAIL: Boo, tests fail, random garbage is not a debit 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests pass! 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- t/db_dependent/api/v1/article_requests.t | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/api/v1/article_requests.t b/t/db_dependent/api/v1/article_requests.t index 02adbdf489f..0bf1b8d73b4 100755 --- a/t/db_dependent/api/v1/article_requests.t +++ b/t/db_dependent/api/v1/article_requests.t @@ -57,8 +57,12 @@ subtest 'cancel() tests' => sub { "//$userid:$password@/api/v1/article_requests/$deleted_article_request_id" )->status_is(404)->json_is( { error => "Article request not found" } ); - my $article_request = - $builder->build_object( { class => 'Koha::ArticleRequests' } ); + my $article_request = $builder->build_object( + { + class => 'Koha::ArticleRequests', + value => { debit_id => undef } + } + ); my $reason = 'A reason'; my $notes = 'Some notes'; @@ -131,7 +135,7 @@ subtest 'patron_cancel() tests' => sub { my $article_request = $builder->build_object( { class => 'Koha::ArticleRequests', - value => { borrowernumber => $patron->id } + value => { borrowernumber => $patron->id, debit_id => undef } } ); -- 2.25.1