Changeset 4938
- Timestamp:
- 09/15/09 16:17:56 (3 years ago)
- Location:
- trunk/SearchEngineKinoSearchAddOn/test/unit/SearchEngineKinoSearchAddOn
- Files:
-
- 2 edited
-
IndexTests.pm (modified) (1 diff)
-
SearchTests.pm (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SearchEngineKinoSearchAddOn/test/unit/SearchEngineKinoSearchAddOn/IndexTests.pm
r4935 r4938 30 30 31 31 #$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'; 32 37 } 33 38 -
trunk/SearchEngineKinoSearchAddOn/test/unit/SearchEngineKinoSearchAddOn/SearchTests.pm
r3284 r4938 4 4 5 5 use strict; 6 use CGI;7 6 8 7 use Foswiki::Func; … … 18 17 $self->{attachmentDir} = 'SearchEngineKinoSearchAddOn/attachement_examples/'; 19 18 } 19 20 20 return $self; 21 21 } … … 27 27 # Use RcsLite so we can manually gen topic revs 28 28 $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'; 29 34 30 35 $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'); 33 38 Just an example topic 34 39 Keyword: startpoint 35 40 HERE 36 Foswiki::Func::saveTopicText( $this->{ users_web}, 'TopicWithWordAttachment', <<'HERE');41 Foswiki::Func::saveTopicText( $this->{test_web}, 'TopicWithWordAttachment', <<'HERE'); 37 42 Just an example topic wird MS Word 38 43 Keyword: redmond 39 44 HERE 40 Foswiki::Func::saveAttachment( $this->{ users_web}, "TopicWithWordAttachment", "Simple_example.doc",45 Foswiki::Func::saveAttachment( $this->{test_web}, "TopicWithWordAttachment", "Simple_example.doc", 41 46 {file => $this->{attachmentDir}."Simple_example.doc"}); 42 47 } … … 51 56 my $search = Foswiki::Contrib::SearchEngineKinoSearchAddOn::Search->newSearch(); 52 57 53 $this->assert(defined($search), "Search ex emplarnot created.")58 $this->assert(defined($search), "Search example not created.") 54 59 } 55 60 … … 68 73 69 74 # Let's create something 70 Foswiki::Func::saveTopicText( $this->{ users_web}, "TopicTitleToSearch", <<'HERE');75 Foswiki::Func::saveTopicText( $this->{test_web}, "TopicTitleToSearch", <<'HERE'); 71 76 Just an example topic 72 77 Keyword: BodyToSearchFor … … 97 102 98 103 # Let's create something 99 Foswiki::Func::saveTopicText( $this->{ users_web}, "TopicTitleToSearch", <<'HERE');104 Foswiki::Func::saveTopicText( $this->{test_web}, "TopicTitleToSearch", <<'HERE'); 100 105 Just an example topic 101 106 Keyword: BodyToSearchFor … … 153 158 154 159 # Let's create something 155 Foswiki::Func::saveTopicText( $this->{ users_web}, "TopicToSearch", <<'HERE');160 Foswiki::Func::saveTopicText( $this->{test_web}, "TopicToSearch", <<'HERE'); 156 161 Just an example topic 157 162 Keyword: BodyToSearchFor 158 163 HERE 159 164 160 Foswiki::Func::saveAttachment( $this->{ users_web}, "TopicToSearch", "Simple_example.doc",165 Foswiki::Func::saveAttachment( $this->{test_web}, "TopicToSearch", "Simple_example.doc", 161 166 {file => $this->{attachmentDir}."Simple_example.doc"}); 162 167 … … 188 193 189 194 # 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'); 191 196 Just an example topic 192 197 Keyword: KeepOutHere 193 * Set ALLOWTOPICVIEW = UserTestUser2198 * Set ALLOWTOPICVIEW = TestUser2 194 199 HERE 195 200 … … 218 223 my ( $this, $web, $topic, $user, $searchString ) = @_; 219 224 220 my $query = new CGI({225 my $query = new Unit::Request({ 221 226 webName => [ $web ], 222 227 topicName => [ $topic ], 223 228 search => [ $searchString ], 224 229 }); 225 226 230 $query->path_info( "$web/$topic" ); 231 232 my $response = new Unit::Response(); 233 $response->charset("utf8"); 227 234 228 235 #my $foswiki = new Foswiki( $this->{test_user_login}, $query ); … … 233 240 # Note: With $foswiki I hand over the just defined session. Thus I have full 234 241 # 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); 236 243 237 244 $foswiki->finish(); 238 $text =~ s/\r//g;239 $text =~ s/^.*?\n\n+//s; # remove CGI header245 #$text =~ s/\r//g; 246 #$text =~ s/^.*?\n\n+//s; # remove CGI header 240 247 return $text; 241 248 }
Note: See TracChangeset
for help on using the changeset viewer.
