| Lines 25-32
          use t::lib::Mocks;
      
      
        Link Here | 
        
          | 25 |  | 25 |  | 
        
          | 26 | use JSON qw(encode_json); | 26 | use JSON qw(encode_json); | 
        
          | 27 |  | 27 |  | 
          
            
              | 28 | use Koha::Illbatch; | 28 | use Koha::ILL::Batch; | 
            
              | 29 | use Koha::Illbatches; | 29 | use Koha::ILL::Batches; | 
        
          | 30 | use Koha::Illrequests; | 30 | use Koha::Illrequests; | 
        
          | 31 | use Koha::IllbatchStatuses; | 31 | use Koha::IllbatchStatuses; | 
        
          | 32 | use Koha::Database; | 32 | use Koha::Database; | 
  
    | Lines 58-64
          subtest 'list() tests' => sub {
      
      
        Link Here | 
        
          | 58 |     $librarian->set_password( { password => $password, skip_validation => 1 } ); | 58 |     $librarian->set_password( { password => $password, skip_validation => 1 } ); | 
        
          | 59 |     my $userid = $librarian->userid; | 59 |     my $userid = $librarian->userid; | 
        
          | 60 |  | 60 |  | 
          
            
              | 61 |     my $batch_to_delete  = $builder->build_object( { class => 'Koha::Illbatches' } ); | 61 |     my $batch_to_delete  = $builder->build_object( { class => 'Koha::ILL::Batches' } ); | 
        
          | 62 |     my $deleted_batch_id = $batch_to_delete->id; | 62 |     my $deleted_batch_id = $batch_to_delete->id; | 
        
          | 63 |     $batch_to_delete->delete; | 63 |     $batch_to_delete->delete; | 
        
          | 64 |  | 64 |  | 
  
    | Lines 70-76
          subtest 'list() tests' => sub {
      
      
        Link Here | 
        
          | 70 |  | 70 |  | 
        
          | 71 |     my $batch_1 = $builder->build_object( | 71 |     my $batch_1 = $builder->build_object( | 
        
          | 72 |         { | 72 |         { | 
          
            
              | 73 |             class => 'Koha::Illbatches', | 73 |             class => 'Koha::ILL::Batches', | 
        
          | 74 |             value => { | 74 |             value => { | 
        
          | 75 |                 backend    => "Mock", | 75 |                 backend    => "Mock", | 
        
          | 76 |                 patron_id  => $librarian->id, | 76 |                 patron_id  => $librarian->id, | 
  
    | Lines 100-106
          subtest 'list() tests' => sub {
      
      
        Link Here | 
        
          | 100 |         ->json_has( '/0/library',      'branch embedded' )->json_has( '/0/requests_count', 'request count' ); | 100 |         ->json_has( '/0/library',      'branch embedded' )->json_has( '/0/requests_count', 'request count' ); | 
        
          | 101 |  | 101 |  | 
        
          | 102 |     # Create a second batch with a different name | 102 |     # Create a second batch with a different name | 
          
            
              | 103 |     my $batch_2 = $builder->build_object( { class => 'Koha::Illbatches' } ); | 103 |     my $batch_2 = $builder->build_object( { class => 'Koha::ILL::Batches' } ); | 
        
          | 104 |  | 104 |  | 
        
          | 105 |     $query = { ill_batch_id => [ $batch_1->id, $batch_2->id ] }; | 105 |     $query = { ill_batch_id => [ $batch_1->id, $batch_2->id ] }; | 
        
          | 106 |  | 106 |  | 
  
    | Lines 155-161
          subtest 'get() tests' => sub {
      
      
        Link Here | 
        
          | 155 |  | 155 |  | 
        
          | 156 |     my $batch = $builder->build_object( | 156 |     my $batch = $builder->build_object( | 
        
          | 157 |         { | 157 |         { | 
          
            
              | 158 |             class => 'Koha::Illbatches', | 158 |             class => 'Koha::ILL::Batches', | 
        
          | 159 |             value => { | 159 |             value => { | 
        
          | 160 |                 backend    => "Mock", | 160 |                 backend    => "Mock", | 
        
          | 161 |                 patron_id  => $librarian->id, | 161 |                 patron_id  => $librarian->id, | 
  
    | Lines 176-182
          subtest 'get() tests' => sub {
      
      
        Link Here | 
        
          | 176 |  | 176 |  | 
        
          | 177 |     $t->get_ok( "//$unauth_userid:$password@/api/v1/ill/batches/" . $batch->id )->status_is(403); | 177 |     $t->get_ok( "//$unauth_userid:$password@/api/v1/ill/batches/" . $batch->id )->status_is(403); | 
        
          | 178 |  | 178 |  | 
          
            
              | 179 |     my $batch_to_delete = $builder->build_object( { class => 'Koha::Illbatches' } ); | 179 |     my $batch_to_delete = $builder->build_object( { class => 'Koha::ILL::Batches' } ); | 
        
          | 180 |     my $non_existent_id = $batch_to_delete->id; | 180 |     my $non_existent_id = $batch_to_delete->id; | 
        
          | 181 |     $batch_to_delete->delete; | 181 |     $batch_to_delete->delete; | 
        
          | 182 |  | 182 |  | 
  
    | Lines 288-294
          subtest 'update() tests' => sub {
      
      
        Link Here | 
        
          | 288 |     my $unauth_userid = $patron->userid; | 288 |     my $unauth_userid = $patron->userid; | 
        
          | 289 |  | 289 |  | 
        
          | 290 |     my $library  = $builder->build_object( { class => 'Koha::Libraries' } ); | 290 |     my $library  = $builder->build_object( { class => 'Koha::Libraries' } ); | 
          
            
              | 291 |     my $batch_id = $builder->build_object( { class => 'Koha::Illbatches' } )->id; | 291 |     my $batch_id = $builder->build_object( { class => 'Koha::ILL::Batches' } )->id; | 
        
          | 292 |  | 292 |  | 
        
          | 293 |     # Unauthorized attempt to update | 293 |     # Unauthorized attempt to update | 
        
          | 294 |     $t->put_ok( "//$unauth_userid:$password@/api/v1/ill/batches/$batch_id" => json => | 294 |     $t->put_ok( "//$unauth_userid:$password@/api/v1/ill/batches/$batch_id" => json => | 
  
    | Lines 336-342
          subtest 'update() tests' => sub {
      
      
        Link Here | 
        
          | 336 |         ] | 336 |         ] | 
        
          | 337 |         ); | 337 |         ); | 
        
          | 338 |  | 338 |  | 
          
            
              | 339 |     my $batch_to_delete = $builder->build_object( { class => 'Koha::Illbatches' } ); | 339 |     my $batch_to_delete = $builder->build_object( { class => 'Koha::ILL::Batches' } ); | 
        
          | 340 |     my $non_existent_id = $batch_to_delete->id; | 340 |     my $non_existent_id = $batch_to_delete->id; | 
        
          | 341 |     $batch_to_delete->delete; | 341 |     $batch_to_delete->delete; | 
        
          | 342 |  | 342 |  | 
  
    | Lines 378-384
          subtest 'delete() tests' => sub {
      
      
        Link Here | 
        
          | 378 |     $patron->set_password( { password => $password, skip_validation => 1 } ); | 378 |     $patron->set_password( { password => $password, skip_validation => 1 } ); | 
        
          | 379 |     my $unauth_userid = $patron->userid; | 379 |     my $unauth_userid = $patron->userid; | 
        
          | 380 |  | 380 |  | 
          
            
              | 381 |     my $batch_id = $builder->build_object( { class => 'Koha::Illbatches' } )->id; | 381 |     my $batch_id = $builder->build_object( { class => 'Koha::ILL::Batches' } )->id; | 
        
          | 382 |  | 382 |  | 
        
          | 383 |     # Unauthorized attempt to delete | 383 |     # Unauthorized attempt to delete | 
        
          | 384 |     $t->delete_ok("//$unauth_userid:$password@/api/v1/ill/batches/$batch_id")->status_is(403); | 384 |     $t->delete_ok("//$unauth_userid:$password@/api/v1/ill/batches/$batch_id")->status_is(403); | 
            
              | 385 | -  |  |  |