| 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 163-168
          my $put_data = {
      
      
        Link Here | 
        
          | 163 |     priority => 2, | 164 |     priority => 2, | 
        
          | 164 |     suspended_until => output_pref({ dt => $suspended_until, dateformat => 'rfc3339' }), | 165 |     suspended_until => output_pref({ dt => $suspended_until, dateformat => 'rfc3339' }), | 
        
          | 165 | }; | 166 | }; | 
            
              |  |  | 167 | my $put_data2 = { | 
            
              | 168 |     pickup_library_id => $branchcode2 | 
            
              | 169 | }; | 
        
          | 166 |  | 170 |  | 
        
          | 167 | subtest "Test endpoints without authentication" => sub { | 171 | subtest "Test endpoints without authentication" => sub { | 
        
          | 168 |     plan tests => 8; | 172 |     plan tests => 8; | 
  
    | Lines 198-204
          subtest "Test endpoints without permission" => sub {
      
      
        Link Here | 
        
          | 198 |  | 202 |  | 
        
          | 199 | subtest "Test endpoints with permission" => sub { | 203 | subtest "Test endpoints with permission" => sub { | 
        
          | 200 |  | 204 |  | 
          
            
              | 201 |     plan tests => 44; | 205 |     plan tests => 51; | 
        
          | 202 |  | 206 |  | 
        
          | 203 |     $t->get_ok( "//$userid_1:$password@/api/v1/holds" ) | 207 |     $t->get_ok( "//$userid_1:$password@/api/v1/holds" ) | 
        
          | 204 |       ->status_is(200) | 208 |       ->status_is(200) | 
  
    | Lines 211-221
          subtest "Test endpoints with permission" => sub {
      
      
        Link Here | 
        
          | 211 |       ->json_is('/0/patron_id', $patron_2->borrowernumber) | 215 |       ->json_is('/0/patron_id', $patron_2->borrowernumber) | 
        
          | 212 |       ->json_hasnt('/1'); | 216 |       ->json_hasnt('/1'); | 
        
          | 213 |  | 217 |  | 
            
              |  |  | 218 |     # While suspended_until is date-time, it's always set to midnight. | 
            
              | 219 |     my $expected_suspended_until = $suspended_until->strftime('%FT00:00:00%z'); | 
            
              | 220 |     substr($expected_suspended_until, -2, 0, ':'); | 
            
              | 221 |  | 
        
          | 214 |     $t->put_ok( "//$userid_1:$password@/api/v1/holds/$reserve_id" => json => $put_data ) | 222 |     $t->put_ok( "//$userid_1:$password@/api/v1/holds/$reserve_id" => json => $put_data ) | 
        
          | 215 |       ->status_is(200) | 223 |       ->status_is(200) | 
        
          | 216 |       ->json_is( '/hold_id', $reserve_id ) | 224 |       ->json_is( '/hold_id', $reserve_id ) | 
          
            
              | 217 |       ->json_is( '/suspended_until', output_pref({ dt => $suspended_until, dateformat => 'rfc3339' }) ) | 225 |       ->json_is( '/suspended_until', $expected_suspended_until ) | 
            
              | 218 |       ->json_is( '/priority', 2 ); | 226 |       ->json_is( '/priority', 2 ) | 
            
              |  |  | 227 |       ->json_is( '/pickup_library_id', $branchcode ); | 
            
              | 228 |  | 
            
              | 229 |     # Change only pickup library, everything else should remain | 
            
              | 230 |     $t->put_ok( "//$userid_1:$password@/api/v1/holds/$reserve_id" => json => $put_data2 ) | 
            
              | 231 |       ->status_is(200) | 
            
              | 232 |       ->json_is( '/hold_id', $reserve_id ) | 
            
              | 233 |       ->json_is( '/suspended_until', $expected_suspended_until ) | 
            
              | 234 |       ->json_is( '/priority', 2 ) | 
            
              | 235 |       ->json_is( '/pickup_library_id', $branchcode2 ); | 
        
          | 219 |  | 236 |  | 
        
          | 220 |     $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) | 237 |     $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) | 
        
          | 221 |       ->status_is(200); | 238 |       ->status_is(200); | 
            
              | 222 | -  |  |  |