Changeset 998


Ignore:
Timestamp:
11/27/08 05:29:58 (3 years ago)
Author:
SvenDowideit
Message:

Item318: initial passing unit tests for view script web&topic parsing

Location:
trunk/UnitTestContrib/test/unit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UnitTestContrib/test/unit/ViewFileScriptTests.pm

    r997 r998  
    110110sub viewfile { 
    111111    my ( $this, $url ) = @_; 
    112     my $query = new Unit::Request({ 
    113 #        webName => [ $this->{test_web} ], 
    114 #        topicName => [ 'TestTopic1' ], 
    115 #        template => [ $tmpl ], 
    116     }); 
     112    my $query = new Unit::Request({}); 
    117113    $query->setUrl( $url ); 
    118114    $query->method('GET'); 
  • trunk/UnitTestContrib/test/unit/ViewScriptTests.pm

    r874 r998  
    8282    $query->method('POST'); 
    8383    $twiki = new Foswiki( $this->{test_user_login}, $query ); 
    84     my ($text, $result) = $this->capture(  
     84    my ($text, $result) = $this->capture( 
    8585        sub { 
    8686            Foswiki::UI::View::view( $twiki); 
     
    121121} 
    122122 
     123sub urltest { 
     124    my ($this, $url, $web, $topic) = @_; 
     125    my $query = new Unit::Request({}); 
     126    $query->setUrl( $url ); 
     127    $query->method('GET'); 
     128    my $twiki = new Foswiki( $this->{test_user_login}, $query ); 
     129    $this->assert_equals($web, $twiki->{webName}); 
     130    $this->assert_equals($topic, $twiki->{topicName}); 
     131 
     132    $twiki->finish(); 
     133} 
     134sub test_urlparsing { 
     135    my $this = shift; 
     136 
     137    $this->urltest('', $this->{users_web}, 'WebHome'); 
     138    $this->urltest('/', $this->{users_web}, 'WebHome'); 
     139#    $this->urltest('Sandbox', 'Sandbox', 'WebHome'); 
     140    $this->urltest('/Sandbox', 'Sandbox', 'WebHome'); 
     141    $this->urltest('/Sandbox/', 'Sandbox', 'WebHome'); 
     142#    $this->urltest('//Sandbox', 'Sandbox', 'WebHome'); 
     143    $this->urltest('/Sandbox//', 'Sandbox', 'WebHome'); 
     144    $this->urltest('/Sandbox/WebHome', 'Sandbox', 'WebHome'); 
     145#    $this->urltest('/Sandbox//WebHome', 'Sandbox', 'WebHome'); 
     146    $this->urltest('/Sandbox/WebHome/', 'Sandbox', 'WebHome'); 
     147#    $this->urltest('/Sandbox/WebHome//', 'Sandbox', 'WebHome'); 
     148 
     149} 
     150 
    1231511; 
Note: See TracChangeset for help on using the changeset viewer.