From 9e947c7d97092e18063a7b87a9423d28932b3f5a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 15 Feb 2024 12:33:26 +0000 Subject: [PATCH] Bug 36100: Update unit tests for add This patch updates the unit tests for booking add to confirm that without readOnly we still return an error should a user attempt to submit a booking with a booking_id that would clash. Signed-off-by: David Nind --- t/db_dependent/api/v1/bookings.t | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/t/db_dependent/api/v1/bookings.t b/t/db_dependent/api/v1/bookings.t index 27595afaeb..14a4396f46 100755 --- a/t/db_dependent/api/v1/bookings.t +++ b/t/db_dependent/api/v1/bookings.t @@ -224,7 +224,8 @@ subtest 'add() tests' => sub { my $unauth_userid = $patron->userid; my $biblio = $builder->build_sample_biblio; - my $item = $builder->build_sample_item( { bookable => 1, biblionumber => $biblio->id } ); + my $item1 = $builder->build_sample_item( { bookable => 1, biblionumber => $biblio->id } ); + my $item2 = $builder->build_sample_item( { bookable => 1, biblionumber => $biblio->id } ); my $booking = { biblio_id => $biblio->id, item_id => undef, @@ -261,14 +262,8 @@ subtest 'add() tests' => sub { # Authorized attempt to create with existing id $booking->{booking_id} = $booking_id; - $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking )->status_is(400)->json_is( - "/errors" => [ - { - message => "Read-only.", - path => "/body/booking_id" - } - ] - ); + $t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking )->status_is(400) + ->json_is( "/error" => "Duplicate booking_id" ); # TODO: Test bookings clashes # TODO: Test item auto-assignment -- 2.30.2