|
From: <jgr...@us...> - 2003-09-09 05:09:02
|
Update of /cvsroot/popfile/engine/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv27342/tests
Modified Files:
TestBayes.tst TestConfiguration.tst TestHTML.script
TestHTML.tst TestHTTP.tst TestLogger.tst TestMailParse009.wrd
TestMailParse023.wrd TestModule.tst TestProxy.tst
Log Message:
English.msg:
Fixed a message that had no trailing </font> and would produce
incorrect HTML.
HTML.pm:
Further work on the performance of the loading and organizing
of the history from disk. Start up is now much faster when
messages have previously been cached to disk. Removal of old
files is delayed until a TICKD event.
Removed various lines of dead/legacy code revealed by the
test suite.
Changed the various checkboxes that are used for history deletion
from all being called remove to having individual names, this
makes them easier to test.
Removed the code for invalidating the history cache, this is
no longer needed because the progressive history update does
away with the need to go looking on disk for changes except
for at startup.
Bayes.pm:
Make QuickMagnets work again.
Change cutoff for unsure messages to 0.4.
Add some close statements to the matrix loader which were missing.
TestModule.tst:
Initialize the logger to prevent a Perl warning.
TestConfiguration.tst:
Fix tests that break with ActivePerl because sort is returning
values in a different order.
TestProxy.pm:
Started working with ActivePerl for the test suite and
discovered that it considers 0 to be a valid port number so
use the port number -1 for bad port number tests.
TestHTTP.pm:
Started working with ActivePerl for the test suite and
discovered that it considers 0 to be a valid port number so
use the port number -1 for bad port number tests.
TestHTML.tst/TestHTML.script:
Tests for QuickMagnets, reclassification, message deletion,
reading of ICO, GIF, PNG, LOG, HTML and CSS files, tests for
the disk caching of history data, archiving of history files.
Additional safety code in the test runner to spot bad
scripts or return codes from HTTP requests. New code to
follow redirects on form submission.
TestHTML.tst now covers 97% of HTML.pm's code. Remaining
tests needed are for the display of magnetized mails.
TestMailParse009.wrd/TestMailParse023.wrd:
Update words list since we now correctly add the domain name
from within an img src tag.
Index: TestBayes.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestBayes.tst,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** TestBayes.tst 24 Aug 2003 04:04:52 -0000 1.25
--- TestBayes.tst 8 Sep 2003 18:03:57 -0000 1.26
***************
*** 66,76 ****
# Test the unclassifier_probability parameter
! test_assert_equal( $b->{unclassified__}, log(0.5) );
! $b->config_( 'unclassified_probability', 0.42 );
test_assert( $b->start() );
! test_assert_equal( $b->{unclassified__}, log(0.42) );
! $b->config_( 'unclassified_probability', 0.5 );
test_assert( $b->start() );
! test_assert_equal( $b->{unclassified__}, log(0.5) );
# test the API functions
--- 66,76 ----
# Test the unclassifier_probability parameter
! test_assert_equal( $b->{unclassified__}, log(100) );
! $b->config_( 'unclassified_weight', 10 );
test_assert( $b->start() );
! test_assert_equal( $b->{unclassified__}, log(10) );
! $b->config_( 'unclassified_weight', 5 );
test_assert( $b->start() );
! test_assert_equal( $b->{unclassified__}, log(5) );
# test the API functions
***************
*** 518,542 ****
# get_stopword_list
! my @stopwords = $b->get_stopword_list();
test_assert_equal( $#stopwords, 1 );
! test_assert_equal( $stopwords[0], 'notthis' );
! test_assert_equal( $stopwords[1], 'andnotthat' );
# add_stopword
test_assert( $b->add_stopword( 'northat' ) );
! @stopwords = $b->get_stopword_list();
test_assert_equal( $#stopwords, 2 );
! test_assert_equal( $stopwords[0], 'northat' );
! test_assert_equal( $stopwords[1], 'notthis' );
! test_assert_equal( $stopwords[2], 'andnotthat' );
# remove_stopword
test_assert( $b->remove_stopword( 'northat' ) );
! @stopwords = $b->get_stopword_list();
test_assert_equal( $#stopwords, 1 );
! test_assert_equal( $stopwords[0], 'notthis' );
! test_assert_equal( $stopwords[1], 'andnotthat' );
# Test history class file reading and writing
--- 518,542 ----
# get_stopword_list
! my @stopwords = sort $b->get_stopword_list();
test_assert_equal( $#stopwords, 1 );
! test_assert_equal( $stopwords[0], 'andnotthat' );
! test_assert_equal( $stopwords[1], 'notthis' );
# add_stopword
test_assert( $b->add_stopword( 'northat' ) );
! @stopwords = sort $b->get_stopword_list();
test_assert_equal( $#stopwords, 2 );
! test_assert_equal( $stopwords[0], 'andnotthat' );
! test_assert_equal( $stopwords[1], 'northat' );
! test_assert_equal( $stopwords[2], 'notthis' );
# remove_stopword
test_assert( $b->remove_stopword( 'northat' ) );
! @stopwords = sort $b->get_stopword_list();
test_assert_equal( $#stopwords, 1 );
! test_assert_equal( $stopwords[0], 'andnotthat' );
! test_assert_equal( $stopwords[1], 'notthis' );
# Test history class file reading and writing
***************
*** 583,587 ****
print FILE "From: test\@test.com\n";
print FILE "Subject: Your attention please\n\n";
! print FILE "This is the body\n.\n";
close FILE;
--- 583,587 ----
print FILE "From: test\@test.com\n";
print FILE "Subject: Your attention please\n\n";
! print FILE "This is the body www.supersizewebhosting.com www.gamelink.com\n.\n";
close FILE;
Index: TestConfiguration.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestConfiguration.tst,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** TestConfiguration.tst 31 Jul 2003 16:32:22 -0000 1.7
--- TestConfiguration.tst 8 Sep 2003 18:03:57 -0000 1.8
***************
*** 126,129 ****
--- 126,131 ----
open FILE, "<popfile.cfg";
my $line = <FILE>;
+ test_assert_regexp( $line, 'config_piddir ../tests/' );
+ $line = <FILE>;
test_assert_regexp( $line, 'GLOBAL_debug 0' );
$line = <FILE>;
***************
*** 139,144 ****
$line = <FILE>;
test_assert_regexp( $line, 'GLOBAL_xtc 1' );
- $line = <FILE>;
- test_assert_regexp( $line, 'config_piddir ../tests/' );
$line = <FILE>;
test_assert_regexp( $line, 'logger_logdir ./' );
--- 141,144 ----
Index: TestHTML.script
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestHTML.script,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** TestHTML.script 28 Aug 2003 15:27:20 -0000 1.15
--- TestHTML.script 8 Sep 2003 18:03:57 -0000 1.16
***************
*** 37,40 ****
--- 37,41 ----
# INPUTIS a b Assert that form item a has value b
# SETINPUT a b Sets the form item a to value b
+ # SETINPUTN a b c Sets the bth input named a to c
# SUBMIT a Finds the form with input a and submits it
# SETSUBMIT a b Just like doing SETINPUT a b followed by SUBMIT a
***************
*** 253,257 ****
GET /history?session=$sk&setsort=
! # TODO Check reclassification
# Check click through from bucket name
--- 254,270 ----
GET /history?session=$sk&setsort=
! # Check reclassification
!
! GET /history
! MATCH Testing Refresh
! SETINPUT 0 spam
! CLICK change
! MATCH Changed to <font color="blue">spam</font>
! MATCH Reclassified as <font color="blue">spam</font>
!
! # Check undo
!
! CLICK undo_0
! MATCH Changed to <font color="green">personal</font>
# Check click through from bucket name
***************
*** 271,277 ****
MATCH <font color=\"green\">personal</font>
MATCH Scores
! MATCH 0.769209
! MATCH 0.230763
! MATCH 2.829186e-05
MATCH <font color="red">here</font>
MATCH 0.0017
--- 284,290 ----
MATCH <font color=\"green\">personal</font>
MATCH Scores
! MATCH 0. [28 zeroes] 265393
! MATCH 0. [29 zeroes] 796179
! MATCH 0. [33 zeroes] 976128
MATCH <font color="red">here</font>
MATCH 0.0017
***************
*** 289,295 ****
MATCH <font color=\"green\">personal</font>
MATCH Scores
! MATCH 0.769209
! MATCH 0.230763
! MATCH 2.829186e-05
MATCH <font color="red">here</font>
MATCH 0.0017
--- 302,308 ----
MATCH <font color=\"green\">personal</font>
MATCH Scores
! MATCH 0. [28 zeroes] 265393
! MATCH 0. [29 zeroes] 796179
! MATCH 0. [33 zeroes] 976128
MATCH <font color="red">here</font>
MATCH 0.0017
***************
*** 303,318 ****
MATCH Recent Messages
! # TODO quick magnets
! # TODO reclassify from single message view
! # TODO Check delete one message
MATCH Testing Refresh
GET /history
! #SETINPUT remove on
! #CLICK deletemessage
! #NOTMATCH Testing Refresh
! # TODO Check delete some messages
# Check delete page of messages
--- 316,369 ----
MATCH Recent Messages
! # Quick Magnets
! GET /jump_to_message?view=popfile10000=1.msg
! MATCH Single Message View
! MATCH <option>Testing</option>
! MATCH <option>Refresh</option>
! MATCH <option>John</option>
! SETINPUT text2 John
! SETINPUT bucket2 other
! CLICK create
! MATCH Current Magnets
! MATCH <input type="text" name="text1" value="John" size="50" />
! SETINPUT remove1 on
! CLICK delete
!
! # Reclassify from single message view
+ GET /view?view=popfile10000=1.msg&start_message=0&session=$sk
+ MATCH Single Message View
MATCH Testing Refresh
+ SETINPUT 0 spam
+ CLICK change
+ MATCH Changed to <font color="blue">spam</font>
+ MATCH Reclassified as <font color="blue">spam</font>
+
+ # Undo on single message view
+
+ GET /view?view=popfile10000=1.msg&start_message=0&session=$sk
+ MATCH Single Message View
+ CLICK undo_0
+ MATCH Changed to <font color="green">personal</font>
+
+ # Check delete one message
+
GET /history
! MATCH Testing Refresh
! SETINPUT remove_1 on
! CLICK deletemessage
! MATCH Recent Messages
! NOTMATCH Testing Refresh
! # Check delete some messages
!
! MATCH test for various HTML parts
! MATCH Enlarge your package Doctor ApprovedNHOB
! SETINPUT remove_4 on
! SETINPUT remove_5 on
! CLICK deletemessage
! NOTMATCH test for various HTML parts
! NOTMATCH Enlarge your package Doctor ApprovedNHOB
# Check delete page of messages
***************
*** 607,616 ****
INPUTIS ui_port 8081
- # TODO Check XMLRPC port (write when doing TestXMLRPC)
- # TODO Check SMTP port (write when doing TestSMTP)
- # TODO Check NNTP port (write when doing TestNNTP)
- # TODO Check NNTP separator (write when doing TestNNTP)
- # TODO Check Windows icon
-
# Security Page
--- 658,661 ----
***************
*** 693,701 ****
MATCH Updated password to
- # TODO Check SMTP stealth (write when doing TestSMTP)
- # TODO Check SMTP chain options (write when doing TestSMTP)
- # TODO Check NNTP stealth (write when doing TestNNTP)
- # TODO Check XMLRPC stealth (write when doing TestXMLRPC)
-
# Advanced Page
--- 738,741 ----
***************
*** 884,887 ****
--- 924,940 ----
MATCH <td width="1%"> </td><td align="right">0</td><td width="1%"> </td>
+ # Test removal of history files that are out of date (old and new style)
+
+ CODE
+ open TEMP, ">messages/popfile1_1.msg";
+ print TEMP, "1\n";
+ close TEMP;
+ open TEMP, ">messages/popfile1=1.msg";
+ print TEMP, "1\n";
+ close TEMP;
+ ENDCODE
+
+ SENDMSG TICKD dummy
+
# Check the login message
***************
*** 895,899 ****
MATCH POPFile Session Expired
! # TODO Get ICO, GIF, CSS, PNG, LOG and HTML file
# Get a page that does not exist
--- 948,995 ----
MATCH POPFile Session Expired
! # Get ICO, GIF, CSS, PNG, LOG and HTML file
!
! CODE
! open TEMP, ">temp.ico";
! print TEMP "10 GOTO 10\n";
! close TEMP;
! ENDCODE
!
! GET /temp.ico
! MATCH 10 GOTO 10
!
! CODE
! rename 'temp.ico', 'temp.gif';
! ENDCODE
!
! GET /temp.gif
! MATCH 10 GOTO 10
!
! CODE
! rename 'temp.gif', 'temp.png';
! ENDCODE
!
! GET /temp.png
! MATCH 10 GOTO 10
!
! CODE
! rename 'temp.png', 'popfile1.log';
! ENDCODE
!
! GET /popfile1.log?session=$sk
! MATCH 10 GOTO 10
!
! CODE
! mkdir 'manual';
! open TEMP, ">manual/temp.html";
! print TEMP "10 GOTO 10\n";
! close TEMP;
! ENDCODE
!
! GET /manual/temp.html
! MATCH 10 GOTO 10
!
! GET /skins/default.css
! MATCH .menuSelected
# Get a page that does not exist
***************
*** 918,921 ****
--- 1014,1026 ----
SETSUBMIT password secret
GET /advanced?session=123456
+ MATCH Enter password:
+ SETSUBMIT password wrong
+ MATCH Enter password:
+ MATCH Incorrect password
+ GET /?session=123456
+ MATCH Enter password:
+ SETSUBMIT password secret
+ MATCH Recent Messages
+ GET /advanced?session=123456&dummy=foo&dummy=bar
MATCH Enter password:
SETSUBMIT password secret
Index: TestHTML.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestHTML.tst,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** TestHTML.tst 24 Aug 2003 01:20:34 -0000 1.18
--- TestHTML.tst 8 Sep 2003 18:03:58 -0000 1.19
***************
*** 64,71 ****
sub find_form
{
! my ( $name ) = @_;
foreach my $form (@forms) {
! my $input = $form->find_input( $name );
if ( defined( $input ) ) {
--- 64,71 ----
sub find_form
{
! my ( $name, $nth ) = @_;
foreach my $form (@forms) {
! my $input = $form->find_input( $name, undef, $nth );
if ( defined( $input ) ) {
***************
*** 100,105 ****
sub form_input
{
! my ( $name, $value ) = @_;
! my ( $form, $input ) = find_form( $name );
if ( defined( $form ) ) {
--- 100,105 ----
sub form_input
{
! my ( $name, $value, $nth ) = @_;
! my ( $form, $input ) = find_form( $name, $nth );
if ( defined( $form ) ) {
***************
*** 217,220 ****
--- 217,259 ----
if ( $command =~ /^__QUIT/ ) {
$h->stop();
+
+ # Test the history disk caching function
+
+ open TEMP, ">messages/popfile1=1.msg";
+ print TEMP "From: John\n\nBody\n";
+ close TEMP;
+
+ $h->start();
+ $h->stop();
+
+ $h->start();
+ $h->stop();
+
+ unlink( 'messages/popfile1=1.msg' );
+
+ $h->start();
+ $h->stop();
+
+ open TEMP, ">messages/popfile1=1.msg";
+ print TEMP "From: John\n\nBody\n";
+ close TEMP;
+ open TEMP, ">messages/popfile1=1.cls";
+ print TEMP "spam\n";
+ close TEMP;
+ open TEMP, ">messages/popfile1_1.msg";
+ print TEMP "From: John\n\nBody\n";
+ close TEMP;
+
+ $h->config_( 'archive', 1 );
+ $h->config_( 'archive_dir', 'archive' );
+ $h->config_( 'archive_classes', 1 );
+
+ `date --set='3 days'`;
+ $h->remove_mail_files();
+ `date --set='3 days ago'`;
+ test_assert( !( -e 'messages/popfile1=1.msg' ) );
+ test_assert( !( -e 'messages/popfile1_1.msg' ) );
+ test_assert( -e 'archive/spam/0/popfile1=1.msg' );
+
print $uwriter "OK\n";
last;
***************
*** 313,319 ****
if ( defined( $request ) ) {
my $response = $ua->request( $request );
! $content = $response->content;
@forms = HTML::Form->parse( $content, "http://127.0.0.1:$port" );
! }
next;
}
--- 352,365 ----
if ( defined( $request ) ) {
my $response = $ua->request( $request );
! if ( $response->code == 302 ) {
! $content = get(url("http://127.0.0.1:$port" . $response->headers->header('Location')));
! } else {
! test_assert_equal( $response->code, 200, "From script line $line_number" );
! $content = $response->content;
! }
@forms = HTML::Form->parse( $content, "http://127.0.0.1:$port" );
! } else {
! test_assert( 0, "Failed to create request form at script line $line_number" );
! }
next;
}
***************
*** 380,383 ****
--- 426,436 ----
}
+ if ( $line =~ /^SETINPUTN +([^ ]+) +(\d+) ?(.+)?$/ ) {
+ my ( $name, $nth, $value ) = ( $1, $2, $3 );
+ $value = '' if ( !defined( $value ) );
+ form_input( $name, $value, $nth );
+ next;
+ }
+
if ( $line =~ /^(SETINPUT|SETSUBMIT) +([^ ]+) ?(.+)?$/ ) {
my ( $name, $value ) = ( $2, $3 );
***************
*** 450,453 ****
--- 503,510 ----
next;
}
+
+ if ( $line =~ /[^ \t\r\n]/ ) {
+ test_assert( 0, "Don't understand line $line_number" );
+ }
}
Index: TestHTTP.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestHTTP.tst,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TestHTTP.tst 31 Jul 2003 16:32:22 -0000 1.2
--- TestHTTP.tst 8 Sep 2003 18:03:58 -0000 1.3
***************
*** 208,212 ****
test_assert( $line =~ /^$eol$/ );
$line = <FILE>;
! test_assert_equal( $line, "somechars\n" );
$line = <FILE>;
test_assert( !defined( $line ) );
--- 208,212 ----
test_assert( $line =~ /^$eol$/ );
$line = <FILE>;
! test_assert_equal( $line, "somechars$eol" );
$line = <FILE>;
test_assert( !defined( $line ) );
***************
*** 223,227 ****
$h2->initialize();
$h2->name( 'simple' );
! $h2->config_( 'port', 0 );
open (STDERR, ">stdout.tmp");
--- 223,227 ----
$h2->initialize();
$h2->name( 'simple' );
! $h2->config_( 'port', -1 );
open (STDERR, ">stdout.tmp");
Index: TestLogger.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestLogger.tst,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TestLogger.tst 31 Jul 2003 16:32:22 -0000 1.4
--- TestLogger.tst 8 Sep 2003 18:03:58 -0000 1.5
***************
*** 23,27 ****
# ---------------------------------------------------------------------------------------------
-
use POPFile::Configuration;
use POPFile::MQ;
--- 23,26 ----
Index: TestMailParse009.wrd
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestMailParse009.wrd,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TestMailParse009.wrd 26 Jun 2003 14:19:41 -0000 1.6
--- TestMailParse009.wrd 8 Sep 2003 18:03:58 -0000 1.7
***************
*** 28,32 ****
header:Date 1
yherkhsdkjfhsdkjfhksjdfhkjsdhfiuweyrkhsdkfjhs 1
! subject:thr 1
perry 1
header:Return-Path 1
--- 28,36 ----
header:Date 1
yherkhsdkjfhsdkjfhksjdfhkjsdhfiuweyrkhsdkfjhs 1
! subject:thrôugh 1
! subject:unçõlleçted 1
! subject:eárn 1
! subject:fántástìç 1
! subject:mõnéy 1
perry 1
header:Return-Path 1
***************
*** 38,42 ****
html:fontcolorwhite 2
header:X-Priority 1
- subject:ted 1
wekrhksjdfhweyhfk 1
luke 1
--- 42,45 ----
***************
*** 50,54 ****
html:fontcolorfuchsia 1
kjsdhfkjsdhfkshdfiwueyrwhsfkjsdhfkh 1
- subject:lle 1
header:X-Mailer 1
header:Received 1
--- 53,56 ----
***************
*** 61,63 ****
subject:judgments 1
header:From 1
! subject:ugh 1
--- 63,65 ----
subject:judgments 1
header:From 1
! 202.108.221.16 4
Index: TestMailParse023.wrd
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestMailParse023.wrd,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TestMailParse023.wrd 26 Jul 2003 22:53:24 -0000 1.1
--- TestMailParse023.wrd 8 Sep 2003 18:03:58 -0000 1.2
***************
*** 3,7 ****
000000 3
0078b3 1
! 27meg.com 11
access 1
action 1
--- 3,7 ----
000000 3
0078b3 1
! 27meg.com 19
access 1
action 1
***************
*** 75,79 ****
transference 1
utu 1
! www.27meg.com 11
young 2
younger 1
--- 75,79 ----
transference 1
utu 1
! www.27meg.com 19
young 2
younger 1
Index: TestModule.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestModule.tst,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TestModule.tst 31 Jul 2003 16:32:22 -0000 1.4
--- TestModule.tst 8 Sep 2003 18:03:58 -0000 1.5
***************
*** 89,92 ****
--- 89,93 ----
$m->logger( $l );
$l->configuration( $c );
+ $l->initialize();
$l->calculate_today__();
$m->global_config_( 'debug', 1 );
Index: TestProxy.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestProxy.tst,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** TestProxy.tst 24 Aug 2003 03:30:10 -0000 1.12
--- TestProxy.tst 8 Sep 2003 18:03:58 -0000 1.13
***************
*** 528,532 ****
$sp2->initialize();
! $sp2->config_( 'port', 0 );
open (STDERR, ">stdout.tmp");
--- 528,532 ----
$sp2->initialize();
! $sp2->config_( 'port', -1 );
open (STDERR, ">stdout.tmp");
|