Lines 252-258
subtest 'add() tests' => sub {
Link Here
|
252 |
|
252 |
|
253 |
subtest 'update() tests' => sub { |
253 |
subtest 'update() tests' => sub { |
254 |
|
254 |
|
255 |
plan tests => 15; |
255 |
plan tests => 20; |
256 |
|
256 |
|
257 |
$schema->storage->txn_begin; |
257 |
$schema->storage->txn_begin; |
258 |
|
258 |
|
Lines 276-282
subtest 'update() tests' => sub {
Link Here
|
276 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
276 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
277 |
my $unauth_userid = $patron->userid; |
277 |
my $unauth_userid = $patron->userid; |
278 |
|
278 |
|
279 |
my $ticket_id = $builder->build_object( { class => 'Koha::Tickets' } )->id; |
279 |
my $ticket = $builder->build_object( { class => 'Koha::Tickets' } ); |
|
|
280 |
my $ticket_id = $ticket->id; |
280 |
|
281 |
|
281 |
# Unauthorized attempt to update |
282 |
# Unauthorized attempt to update |
282 |
$t->put_ok( |
283 |
$t->put_ok( |
Lines 305-310
subtest 'update() tests' => sub {
Link Here
|
305 |
$ticket_with_updated_field )->status_is(200) |
306 |
$ticket_with_updated_field )->status_is(200) |
306 |
->json_is( '/title' => 'Test ticket update' ); |
307 |
->json_is( '/title' => 'Test ticket update' ); |
307 |
|
308 |
|
|
|
309 |
# Set the assignee on PUT |
310 |
$ticket_with_updated_field->{assignee_id} = $librarian->id; |
311 |
$t->put_ok( "//$userid:$password@/api/v1/tickets/$ticket_id" => json => |
312 |
$ticket_with_updated_field )->status_is(200) |
313 |
->json_is( '/title' => 'Test ticket update' ) |
314 |
->json_is( '/assignee_id' => $librarian->id ); |
315 |
|
316 |
my $updates = $ticket->updates; |
317 |
is( $updates->count, 1, "Ticket update added for assignee change" ); |
318 |
|
308 |
# Authorized attempt to write invalid data |
319 |
# Authorized attempt to write invalid data |
309 |
my $ticket_with_invalid_field = { |
320 |
my $ticket_with_invalid_field = { |
310 |
blah => "Ticket Blah", |
321 |
blah => "Ticket Blah", |
311 |
- |
|
|