Bug 36936: Squash warning in bookings test

Simple catch for the warning throwing by DuplicateID exceptions in the
bookings.t api tests.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-06-26 14:12:48 +01:00 committed by Katrin Fischer
parent 6caedbfc00
commit 7c5a96e6eb
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -19,6 +19,7 @@ use Modern::Perl;
use Test::More tests => 5;
use Test::Mojo;
use Test::Warn;
use t::lib::TestBuilder;
use t::lib::Mocks;
@ -189,7 +190,7 @@ subtest 'get() tests' => sub {
subtest 'add() tests' => sub {
plan tests => 15;
plan tests => 16;
$schema->storage->txn_begin;
@ -264,8 +265,11 @@ 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(409)
->json_is( "/error" => "Duplicate booking_id" );
warnings_like {
$t->post_ok( "//$userid:$password@/api/v1/bookings" => json => $booking )->status_is(409)
->json_is( "/error" => "Duplicate booking_id" );
}
qr/DBD::mysql::st execute failed: Duplicate entry '(.*?)' for key 'PRIMARY'/;
# TODO: Test bookings clashes
# TODO: Test item auto-assignment