From 52995e12a50a74420e9737f53785cbf8728691af Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 16 Apr 2024 18:49:19 +0100 Subject: [PATCH] Bug 36612: Unit test for public ticket add Signed-off-by: David Nind --- t/db_dependent/api/v1/tickets.t | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/tickets.t b/t/db_dependent/api/v1/tickets.t index 788d32a252..e77a20e8a8 100755 --- a/t/db_dependent/api/v1/tickets.t +++ b/t/db_dependent/api/v1/tickets.t @@ -146,7 +146,7 @@ subtest 'get() tests' => sub { subtest 'add() tests' => sub { - plan tests => 21; + plan tests => 22; $schema->storage->txn_begin; @@ -244,6 +244,25 @@ subtest 'add() tests' => sub { ] ); + subtest 'public add' => sub { + plan tests => 7; + + delete $ticket->{ticket_id}; + + my $useridp = $patron->userid; + $patron->set_password( { password => $password, skip_validation => 1 } ); + + $ticket_id = + $t->post_ok( "//$useridp:$password@/api/v1/public/tickets" => json => $ticket ) + ->status_is( 201, 'SWAGGER3.2.1' )->header_like( + Location => qr|^\/api\/v1\/public\/tickets/\d*|, + 'SWAGGER3.4.1' + )->json_is( '/biblio_id' => $ticket->{biblio_id} )->json_is( '/title' => $ticket->{title} ) + ->json_is( '/body' => $ticket->{body} )->json_is( '/reporter_id' => $patron->id ) + ->tx->res->json->{ticket_id}; + + }; + $schema->storage->txn_rollback; }; -- 2.30.2