From c241725ac01ec12b6c943acf3db28957693dcbc8 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 26 Jun 2024 14:12:48 +0100 Subject: [PATCH] Bug 36936: Squash warning in bookings test Content-Type: text/plain; charset=utf-8 Simple catch for the warning throwing by DuplicateID exceptions in the bookings.t api tests. Signed-off-by: Martin Renvoize Signed-off-by: Marcel de Rooy --- t/db_dependent/api/v1/bookings.t | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/api/v1/bookings.t b/t/db_dependent/api/v1/bookings.t index 97f2c20261..e616c35d75 100755 --- a/t/db_dependent/api/v1/bookings.t +++ b/t/db_dependent/api/v1/bookings.t @@ -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 -- 2.30.2