| 
      
            Lines 42-48
          SKIP: {
      
      
        Link Here
      
     | 
  
        
          | 42 | 
              my $driver   = $s->driver;  | 
          42 | 
              my $driver   = $s->driver;  | 
        
        
          | 43 | 
           | 
          43 | 
           | 
        
        
          | 44 | 
              subtest 'Staff interface authentication' => sub { | 
          44 | 
              subtest 'Staff interface authentication' => sub { | 
        
          
            
              | 45 | 
                      plan tests => 6;  | 
              45 | 
                      plan tests => 7;  | 
            
        
          | 46 | 
                  my $mainpage = $s->base_url . q|mainpage.pl|;  | 
          46 | 
                  my $mainpage = $s->base_url . q|mainpage.pl|;  | 
        
        
          | 47 | 
                  $driver->get($mainpage);  | 
          47 | 
                  $driver->get($mainpage);  | 
        
        
          | 48 | 
                  like( $driver->get_title, qr(Log in to Koha), 'Hitting the main page should redirect to the login form');  | 
          48 | 
                  like( $driver->get_title, qr(Log in to Koha), 'Hitting the main page should redirect to the login form');  | 
        
  
    | 
      
            Lines 52-61
          SKIP: {
      
      
        Link Here
      
     | 
  
        
          | 52 | 
                  t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );  | 
          52 | 
                  t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 );  | 
        
        
          | 53 | 
                  $patron->set_password({ password => $password }); | 
          53 | 
                  $patron->set_password({ password => $password }); | 
        
        
          | 54 | 
           | 
          54 | 
           | 
        
          
            
              | 55 | 
                      # Patron does not have permission to access staff interface  | 
              55 | 
                      # Patron is authenticated but is not authorized to access staff interface  | 
            
        
          | 56 | 
                  $s->auth( $patron->userid, $password );  | 
          56 | 
                  $s->auth( $patron->userid, $password );  | 
        
        
          | 57 | 
                  like( $driver->get_title, qr(Access denied), 'Patron without permission should be redirected to the login form' );  | 
          57 | 
                  like( $driver->get_title, qr(Access denied), 'Patron without permission should be redirected to the login form' );  | 
        
        
          | 58 | 
           | 
          58 | 
           | 
        
            
               | 
               | 
              59 | 
                      # Try logging in as someone else (even a non-existent patron) and you should still be denied access  | 
            
            
              | 60 | 
                      $s->auth('Bond','James Bond'); | 
            
            
              | 61 | 
                      like( $driver->get_title, qr(Invalid username or password), 'Trying to change to a non-existent user should fail login' );  | 
            
            
              | 62 | 
               | 
            
        
          | 59 | 
                  $driver->get($mainpage . q|?logout.x=1|);  | 
          63 | 
                  $driver->get($mainpage . q|?logout.x=1|);  | 
        
        
          | 60 | 
                  $patron->flags(4)->store; # catalogue permission  | 
          64 | 
                  $patron->flags(4)->store; # catalogue permission  | 
        
        
          | 61 | 
                  $s->auth( $patron->userid, $password );  | 
          65 | 
                  $s->auth( $patron->userid, $password );  | 
        
            
              | 62 | 
              -   | 
               | 
               |