Ignore:
Timestamp:
01/25/12 10:32:32 (4 months ago)
Author:
PaulHarvey
Message:

Item11431: Don't Foswiki->new/finish

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CommentPlugin/test/unit/CommentPlugin/CommentPluginTests.pm

    r13672 r13824  
    237237    } 
    238238 
    239     my $session = Foswiki->new( $Foswiki::cfg{DefaultUserLogin}, $query ); 
     239    $this->createNewFoswikiSession( $Foswiki::cfg{DefaultUserLogin}, $query ); 
    240240    my $text = "Ignore this text"; 
    241241 
    242242    # invoke the save handler 
    243     $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     243    $this->captureWithKey( rest => $this->getUIFn('rest'), $this->{session} ); 
    244244 
    245245    $text = Foswiki::Func::readTopicText( $web, $topic ); 
     
    483483    $query->path_info("/CommentPlugin/comment"); 
    484484 
    485     my $session = Foswiki->new( $Foswiki::cfg{DefaultUserLogin}, $query ); 
     485    $this->createNewFoswikiSession( $Foswiki::cfg{DefaultUserLogin}, $query ); 
    486486    my $text = "Ignore this text"; 
    487487 
    488488    # invoke the save handler 
    489     $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     489    $this->captureWithKey( rest => $this->getUIFn('rest'), $this->{session} ); 
    490490 
    491491    $text = 
     
    528528    $query->path_info("/CommentPlugin/comment"); 
    529529 
    530     my $session = Foswiki->new( $Foswiki::cfg{DefaultUserLogin}, $query ); 
     530    $this->createNewFoswikiSession( $Foswiki::cfg{DefaultUserLogin}, $query ); 
    531531    my $text = "Ignore this text"; 
    532532 
    533533    # invoke the save handler 
    534     $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     534    $this->captureWithKey( rest => $this->getUIFn('rest'), $this->{session} ); 
    535535 
    536536    $text = 
     
    596596    $query->path_info("/CommentPlugin/comment"); 
    597597 
    598     my $session = Foswiki->new( $Foswiki::cfg{DefaultUserLogin}, $query ); 
     598    $this->createNewFoswikiSession( $Foswiki::cfg{DefaultUserLogin}, $query ); 
    599599    my $text = "Ignore this text"; 
    600600 
    601601    # invoke the save handler 
    602     $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     602    $this->captureWithKey( rest => $this->getUIFn('rest'), $this->{session} ); 
    603603 
    604604    $text = 
     
    652652    $query->path_info("/CommentPlugin/comment"); 
    653653 
    654     my $session = Foswiki->new( $Foswiki::cfg{DefaultUserLogin}, $query ); 
     654    $this->createNewFoswikiSession( $Foswiki::cfg{DefaultUserLogin}, $query ); 
    655655    my $text = "Ignore this text"; 
    656656 
    657657    # invoke the save handler 
    658     $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     658    $this->captureWithKey( rest => $this->getUIFn('rest'), $this->{session} ); 
    659659 
    660660    $text = 
     
    704704    $Foswiki::cfg{Plugins}{CommentPlugin}{RequiredForSave} = 'CHANGE'; 
    705705 
    706     my ( $responseText, $result, $stdout, $stderr, $session ); 
     706    my ( $responseText, $result, $stdout, $stderr ); 
    707707 
    708708    # First make sure we can't *change* it 
    709     $session = Foswiki->new( $Foswiki::cfg{DefaultUserLogin}, $query ); 
     709    $this->createNewFoswikiSession( $Foswiki::cfg{DefaultUserLogin}, $query ); 
    710710 
    711711    # invoke the save handler 
    712712    eval { 
    713         ( $responseText, $result, $stdout, $stderr ) = 
    714           $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     713        ( $responseText, $result, $stdout, $stderr ) = $this->captureWithKey( 
     714            rest => $this->getUIFn('rest'), 
     715            $this->{session} 
     716        ); 
    715717    }; 
    716718 
     
    721723    $Foswiki::cfg{Plugins}{CommentPlugin}{RequiredForSave} = 'COMMENT'; 
    722724 
    723     $session = Foswiki->new( $Foswiki::cfg{DefaultUserLogin}, $query ); 
     725    $this->createNewFoswikiSession( $Foswiki::cfg{DefaultUserLogin}, $query ); 
    724726 
    725727    # invoke the save handler 
    726728    eval { 
    727         ( $responseText, $result, $stdout, $stderr ) = 
    728           $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     729        ( $responseText, $result, $stdout, $stderr ) = $this->captureWithKey( 
     730            rest => $this->getUIFn('rest'), 
     731            $this->{session} 
     732        ); 
    729733    }; 
    730734    $this->assert( !$@ ); 
     
    768772    $query->path_info("/CommentPlugin/comment"); 
    769773    my ( $responseText, $result, $stdout, $stderr ); 
    770     my $session = $this->createNewFoswikiSession( undef, $query ); 
     774    $this->createNewFoswikiSession( undef, $query ); 
    771775    eval { 
    772         ( $responseText, $result, $stdout, $stderr ) = 
    773           $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     776        ( $responseText, $result, $stdout, $stderr ) = $this->captureWithKey( 
     777            rest => $this->getUIFn('rest'), 
     778            $this->{session} 
     779        ); 
    774780    }; 
    775781    $this->assert_matches( qr/Status: 404/, $responseText ); 
     
    801807    $query->path_info("/CommentPlugin/comment"); 
    802808 
    803     my $session = Foswiki->new( $Foswiki::cfg{DefaultUserLogin}, $query ); 
     809    $this->createNewFoswikiSession( $Foswiki::cfg{DefaultUserLogin}, $query ); 
    804810    my $text = "Ignore this text"; 
    805811 
     
    807813    # $responseText, $result, $stdout, $stderr 
    808814    my ( $response, $result, $stdout, $stderr ) = 
    809       $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     815      $this->captureWithKey( rest => $this->getUIFn('rest'), $this->{session} ); 
    810816 
    811817    $this->assert_matches( qr/^Status: 302/ms, $response ); 
     
    878884    $query->path_info("/CommentPlugin/comment"); 
    879885 
    880     my $session = Foswiki->new( $Foswiki::cfg{DefaultUserLogin}, $query ); 
     886    $this->createNewFoswikiSession( $Foswiki::cfg{DefaultUserLogin}, $query ); 
    881887    my $text = "Ignore this text"; 
    882888 
     
    884890    # $responseText, $result, $stdout, $stderr 
    885891    my ( $response, $result, $stdout, $stderr ) = 
    886       $this->captureWithKey( rest => $this->getUIFn('rest'), $session ); 
     892      $this->captureWithKey( rest => $this->getUIFn('rest'), $this->{session} ); 
    887893 
    888894    $this->assert_matches( qr/^Status: 302/ms, $response ); 
Note: See TracChangeset for help on using the changeset viewer.