Bugzilla – Attachment 165671 Details for
Bug 35657
Add ability to assign tickets to librarians for catalog concerns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35657: Unit tests for ticket_update api addition
Bug-35657-Unit-tests-for-ticketupdate-api-addition.patch (text/plain), 4.20 KB, created by
Martin Renvoize (ashimema)
on 2024-04-26 16:09:23 UTC
(
hide
)
Description:
Bug 35657: Unit tests for ticket_update api addition
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-26 16:09:23 UTC
Size:
4.20 KB
patch
obsolete
>From 425f38cecb181c06575dbce8a53db6c71c1f4d42 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 26 Apr 2024 14:48:30 +0100 >Subject: [PATCH] Bug 35657: Unit tests for ticket_update api addition > >This patch adds unit tests for the addition of assignee handling in the >ticket update endpoint >--- > t/db_dependent/api/v1/ticket_updates.t | 48 ++++++++++++++++++++++++-- > 1 file changed, 46 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/api/v1/ticket_updates.t b/t/db_dependent/api/v1/ticket_updates.t >index 7349c2761e8..94f5b7caed5 100755 >--- a/t/db_dependent/api/v1/ticket_updates.t >+++ b/t/db_dependent/api/v1/ticket_updates.t >@@ -118,7 +118,7 @@ subtest 'list_updates() tests' => sub { > > subtest 'add_update() tests' => sub { > >- plan tests => 37; >+ plan tests => 60; > > $schema->storage->txn_begin; > >@@ -174,6 +174,8 @@ subtest 'add_update() tests' => sub { > 'SWAGGER3.4.1' > )->json_is( '/message' => $update->{message} ) > ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => undef ) >+ ->json_is( '/assignee_id' => undef ) > ->json_is( '/user_id' => $librarian->id )->tx->res->json->{update_id}; > > # Check that notice trigger didn't fire for non-public update >@@ -226,6 +228,8 @@ subtest 'add_update() tests' => sub { > 'SWAGGER3.4.1' > )->json_is( '/message' => $update->{message} ) > ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => undef ) >+ ->json_is( '/assignee_id' => undef ) > ->json_is( '/user_id' => $librarian->id )->tx->res->json->{update_id}; > > $notices = >@@ -240,7 +244,6 @@ subtest 'add_update() tests' => sub { > > # Check that state change triggers correct notice > $update->{state} = 'resolved'; >- $update->{status} = 'TEST'; > $update_id = > $t->post_ok( > "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => >@@ -249,6 +252,8 @@ subtest 'add_update() tests' => sub { > 'SWAGGER3.4.1' > )->json_is( '/message' => $update->{message} ) > ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => undef ) >+ ->json_is( '/assignee_id' => undef ) > ->json_is( '/user_id' => $librarian->id )->tx->res->json->{update_id}; > > $notices = >@@ -268,11 +273,50 @@ subtest 'add_update() tests' => sub { > ); > isnt( $ticket->resolved_date, undef, "Ticket was given resolved_date when state was updated to 'resolved'" ); > >+ $update->{public} = Mojo::JSON->false; >+ $update->{state} = undef; >+ > # Check that status change is carried over to ticket >+ $update->{status} = 'TEST'; >+ $update_id = >+ $t->post_ok( >+ "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => >+ $update )->status_is( 201, 'SWAGGER3.2.1' )->header_like( >+ Location => qr|^\/api\/v1\/tickets/\d*|, >+ 'SWAGGER3.4.1' >+ )->json_is( '/message' => $update->{message} ) >+ ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => $update->{status} ) >+ ->json_is( '/assignee_id' => undef ) >+ ->json_is( '/user_id' => $librarian->id )->tx->res->json->{update_id}; >+ >+ $ticket = $ticket->get_from_storage; > is( > $ticket->status, 'TEST', > "Ticket status was updated in line with status change in update" > ); > >+ $update->{status} = undef; >+ >+ # Check that assignee is carried over to ticket >+ $update->{assignee_id} = $librarian->id; >+ $update_id = >+ $t->post_ok( >+ "//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => >+ $update )->status_is( 201, 'SWAGGER3.2.1' )->header_like( >+ Location => qr|^\/api\/v1\/tickets/\d*|, >+ 'SWAGGER3.4.1' >+ )->json_is( '/message' => $update->{message} ) >+ ->json_is( '/public' => $update->{public} ) >+ ->json_is( '/status' => $update->{status} ) >+ ->json_is( '/assignee_id' => $update->{assignee_id} ) >+ ->json_is( '/user_id' => $librarian->id )->tx->res->json->{update_id}; >+ >+ $ticket = $ticket->get_from_storage; >+ is( >+ $ticket->assignee_id, $update->{assignee_id}, >+ "Ticket assignee was updated in line with assignee change in update" >+ ); >+ > $schema->storage->txn_rollback; > }; >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35657
:
160365
|
160366
|
160367
|
160368
|
160369
|
160372
|
160373
|
160374
|
160375
|
160376
|
160377
|
164923
|
164924
|
164925
|
164926
|
164927
|
164928
|
164932
|
164933
|
164934
|
164935
|
164974
|
164975
|
164976
|
164977
|
165666
|
165667
|
165668
|
165669
|
165670
|
165671
|
165672
|
165673
|
165674
|
165675
|
165676
|
165677
|
165678
|
165679
|
165786
|
165787
|
165788
|
165789
|
165790
|
165791
|
165792
|
165878
|
165879
|
165880
|
165881
|
165882
|
165883
|
165884
|
165885
|
165886
|
166067