| Lines 47-52
          my $t = Test::Mojo->new('Koha::REST::V1');
      
      
        Link Here | 
        
          | 47 |  | 47 |  | 
        
          | 48 | my $categorycode = $builder->build({ source => 'Category' })->{categorycode}; | 48 | my $categorycode = $builder->build({ source => 'Category' })->{categorycode}; | 
        
          | 49 | my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; | 49 | my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; | 
            
              |  |  | 50 | my $branchcode2 = $builder->build({ source => 'Branch' })->{branchcode}; | 
        
          | 50 | my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype}; | 51 | my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype}; | 
        
          | 51 |  | 52 |  | 
        
          | 52 | # Generic password for everyone | 53 | # Generic password for everyone | 
  
    | Lines 198-204
          subtest "Test endpoints without permission" => sub {
      
      
        Link Here | 
        
          | 198 |  | 199 |  | 
        
          | 199 | subtest "Test endpoints with permission" => sub { | 200 | subtest "Test endpoints with permission" => sub { | 
        
          | 200 |  | 201 |  | 
          
            
              | 201 |     plan tests => 44; | 202 |     plan tests => 57; | 
        
          | 202 |  | 203 |  | 
        
          | 203 |     $t->get_ok( "//$userid_1:$password@/api/v1/holds" ) | 204 |     $t->get_ok( "//$userid_1:$password@/api/v1/holds" ) | 
        
          | 204 |       ->status_is(200) | 205 |       ->status_is(200) | 
  
    | Lines 211-221
          subtest "Test endpoints with permission" => sub {
      
      
        Link Here | 
        
          | 211 |       ->json_is('/0/patron_id', $patron_2->borrowernumber) | 212 |       ->json_is('/0/patron_id', $patron_2->borrowernumber) | 
        
          | 212 |       ->json_hasnt('/1'); | 213 |       ->json_hasnt('/1'); | 
        
          | 213 |  | 214 |  | 
            
              |  |  | 215 |     # While suspended_until is date-time, it's always set to midnight. | 
            
              | 216 |     my $expected_suspended_until = $suspended_until->strftime('%FT00:00:00%z'); | 
            
              | 217 |     substr($expected_suspended_until, -2, 0, ':'); | 
            
              | 218 |  | 
        
          | 214 |     $t->put_ok( "//$userid_1:$password@/api/v1/holds/$reserve_id" => json => $put_data ) | 219 |     $t->put_ok( "//$userid_1:$password@/api/v1/holds/$reserve_id" => json => $put_data ) | 
        
          | 215 |       ->status_is(200) | 220 |       ->status_is(200) | 
        
          | 216 |       ->json_is( '/hold_id', $reserve_id ) | 221 |       ->json_is( '/hold_id', $reserve_id ) | 
          
            
              | 217 |       ->json_is( '/suspended_until', output_pref({ dt => $suspended_until, dateformat => 'rfc3339' }) ) | 222 |       ->json_is( '/suspended_until', $expected_suspended_until ) | 
            
              | 218 |       ->json_is( '/priority', 2 ); | 223 |       ->json_is( '/priority', 2 ) | 
            
              |  |  | 224 |       ->json_is( '/pickup_library_id', $branchcode ); | 
            
              | 225 |  | 
            
              | 226 |     # Change only pickup library, everything else should remain | 
            
              | 227 |     $t->put_ok( "//$userid_1:$password@/api/v1/holds/$reserve_id" => json => { pickup_library_id => $branchcode2 } ) | 
            
              | 228 |       ->status_is(200) | 
            
              | 229 |       ->json_is( '/hold_id', $reserve_id ) | 
            
              | 230 |       ->json_is( '/suspended_until', $expected_suspended_until ) | 
            
              | 231 |       ->json_is( '/priority', 2 ) | 
            
              | 232 |       ->json_is( '/pickup_library_id', $branchcode2 ); | 
            
              | 233 |  | 
            
              | 234 |     # Reset suspended_until, everything else should remain | 
            
              | 235 |     $t->put_ok( "//$userid_1:$password@/api/v1/holds/$reserve_id" => json => { suspended_until => undef } ) | 
            
              | 236 |       ->status_is(200) | 
            
              | 237 |       ->json_is( '/hold_id', $reserve_id ) | 
            
              | 238 |       ->json_is( '/suspended_until', undef ) | 
            
              | 239 |       ->json_is( '/priority', 2 ) | 
            
              | 240 |       ->json_is( '/pickup_library_id', $branchcode2 ); | 
        
          | 219 |  | 241 |  | 
        
          | 220 |     $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) | 242 |     $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) | 
        
          | 221 |       ->status_is(200); | 243 |       ->status_is(200); | 
            
              | 222 | -  |  |  |