Changeset 4938


Ignore:
Timestamp:
09/15/09 16:17:56 (3 years ago)
Author:
AndrewJones
Message:

Item1363: still fighting the tests. just checking in so I can work on another machine

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

Legend:

Unmodified
Added
Removed
  • trunk/SearchEngineKinoSearchAddOn/test/unit/SearchEngineKinoSearchAddOn/IndexTests.pm

    r4935 r4938  
    3030 
    3131    #$this->registerUser("TestUser", "User", "TestUser", 'testuser@an-address.net'); 
     32     
     33    $Foswiki::cfg{SearchEngineKinoSearchAddOn}{Debug} = 1; 
     34     
     35    # don't bother indexing everything, we only want the temporary webs. Makes the tests a lot quicker 
     36    $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipWebs} = 'Trash, Sandbox, System, TWiki, Main, TestCases'; 
    3237} 
    3338 
  • trunk/SearchEngineKinoSearchAddOn/test/unit/SearchEngineKinoSearchAddOn/SearchTests.pm

    r3284 r4938  
    44 
    55use strict; 
    6 use CGI; 
    76 
    87use Foswiki::Func; 
     
    1817        $self->{attachmentDir} = 'SearchEngineKinoSearchAddOn/attachement_examples/'; 
    1918    } 
     19     
    2020    return $self; 
    2121} 
     
    2727    # Use RcsLite so we can manually gen topic revs 
    2828    $Foswiki::cfg{StoreImpl} = 'RcsLite'; 
     29     
     30    $Foswiki::cfg{SearchEngineKinoSearchAddOn}{Debug} = 1; 
     31     
     32    # don't bother indexing everything, we only want the temporary webs. Makes the tests a lot quicker 
     33    $Foswiki::cfg{SearchEngineKinoSearchAddOn}{SkipWebs} = 'Trash, Sandbox, System, TWiki, Main, TestCases'; 
    2934 
    3035    $this->registerUser("TestUser", "User", "TestUser", 'testuser@an-address.net'); 
    31     $this->assert( defined $this->{users_web}, "no {users_web}" ); 
    32     Foswiki::Func::saveTopicText( $this->{users_web}, 'TopicWithoutAttachment', <<'HERE'); 
     36    $this->assert( defined $this->{test_web}, "no {test_web}" ); 
     37    Foswiki::Func::saveTopicText( $this->{test_web}, 'TopicWithoutAttachment', <<'HERE'); 
    3338Just an example topic 
    3439Keyword: startpoint 
    3540HERE 
    36         Foswiki::Func::saveTopicText( $this->{users_web}, 'TopicWithWordAttachment', <<'HERE'); 
     41        Foswiki::Func::saveTopicText( $this->{test_web}, 'TopicWithWordAttachment', <<'HERE'); 
    3742Just an example topic wird MS Word 
    3843Keyword: redmond 
    3944HERE 
    40         Foswiki::Func::saveAttachment( $this->{users_web}, "TopicWithWordAttachment", "Simple_example.doc", 
     45        Foswiki::Func::saveAttachment( $this->{test_web}, "TopicWithWordAttachment", "Simple_example.doc", 
    4146                                       {file => $this->{attachmentDir}."Simple_example.doc"}); 
    4247} 
     
    5156    my $search = Foswiki::Contrib::SearchEngineKinoSearchAddOn::Search->newSearch(); 
    5257 
    53     $this->assert(defined($search), "Search exemplar not created.") 
     58    $this->assert(defined($search), "Search example not created.") 
    5459} 
    5560 
     
    6873 
    6974    # Let's create something 
    70     Foswiki::Func::saveTopicText( $this->{users_web}, "TopicTitleToSearch", <<'HERE'); 
     75    Foswiki::Func::saveTopicText( $this->{test_web}, "TopicTitleToSearch", <<'HERE'); 
    7176Just an example topic 
    7277Keyword: BodyToSearchFor 
     
    97102 
    98103    # Let's create something 
    99     Foswiki::Func::saveTopicText( $this->{users_web}, "TopicTitleToSearch", <<'HERE'); 
     104    Foswiki::Func::saveTopicText( $this->{test_web}, "TopicTitleToSearch", <<'HERE'); 
    100105Just an example topic 
    101106Keyword: BodyToSearchFor 
     
    153158 
    154159    # Let's create something 
    155     Foswiki::Func::saveTopicText( $this->{users_web}, "TopicToSearch", <<'HERE'); 
     160    Foswiki::Func::saveTopicText( $this->{test_web}, "TopicToSearch", <<'HERE'); 
    156161Just an example topic 
    157162Keyword: BodyToSearchFor 
    158163HERE 
    159164 
    160         Foswiki::Func::saveAttachment( $this->{users_web}, "TopicToSearch", "Simple_example.doc", 
     165        Foswiki::Func::saveAttachment( $this->{test_web}, "TopicToSearch", "Simple_example.doc", 
    161166                                       {file => $this->{attachmentDir}."Simple_example.doc"}); 
    162167 
     
    188193 
    189194    # Now I create a topic that only "TestUser2" can read 
    190     Foswiki::Func::saveTopicText( $this->{users_web}, "TopicWithAccesControl", << 'HERE'); 
     195    Foswiki::Func::saveTopicText( $this->{test_web}, "TopicWithAccesControl", << 'HERE'); 
    191196Just an example topic 
    192197Keyword: KeepOutHere 
    193       * Set ALLOWTOPICVIEW = UserTestUser2 
     198   * Set ALLOWTOPICVIEW = TestUser2 
    194199HERE 
    195200 
     
    218223    my ( $this, $web, $topic, $user, $searchString ) = @_; 
    219224     
    220     my $query = new CGI({ 
     225    my $query = new Unit::Request({ 
    221226        webName   => [ $web ], 
    222227        topicName => [ $topic ], 
    223228        search    => [ $searchString ], 
    224229    }); 
    225  
    226230    $query->path_info( "$web/$topic" ); 
     231     
     232    my $response = new Unit::Response(); 
     233    $response->charset("utf8"); 
    227234 
    228235    #my $foswiki  = new Foswiki( $this->{test_user_login}, $query ); 
     
    233240    # Note: With $foswiki I hand over the just defined session. Thus I have full  
    234241    # control over query etc. 
    235     my ($text, $result) = $this->capture( \&Foswiki::Contrib::SearchEngineKinoSearchAddOn::Search::search, $search, undef, $foswiki); 
     242    my ($text, $result) = $this->capture( \&Foswiki::Contrib::SearchEngineKinoSearchAddOn::Search::search, $search, 1, $foswiki); 
    236243 
    237244    $foswiki->finish(); 
    238     $text =~ s/\r//g; 
    239     $text =~ s/^.*?\n\n+//s; # remove CGI header 
     245    #$text =~ s/\r//g; 
     246    #$text =~ s/^.*?\n\n+//s; # remove CGI header 
    240247    return $text; 
    241248} 
Note: See TracChangeset for help on using the changeset viewer.