Update of /cvsroot/popfile/engine/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13293/tests
Modified Files:
Tag: b0_22_2
TestIMAP.tst
Log Message:
Initial tests for validate_item()
Index: TestIMAP.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestIMAP.tst,v
retrieving revision 1.3.4.6
retrieving revision 1.3.4.7
diff -C2 -d -r1.3.4.6 -r1.3.4.7
*** TestIMAP.tst 19 Nov 2007 10:11:48 -0000 1.3.4.6
--- TestIMAP.tst 23 Nov 2007 07:00:18 -0000 1.3.4.7
***************
*** 183,187 ****
my $hash = ($h->get_slot_fields( $_ ))[6];
test_assert_equal( $im->can_reclassify__( $hash, 'spam' ), undef );
! test_assert_equal( $im->can_classify__( $hash ), undef ); #QUATSCH
}
--- 183,187 ----
my $hash = ($h->get_slot_fields( $_ ))[6];
test_assert_equal( $im->can_reclassify__( $hash, 'spam' ), undef );
! test_assert( ! $im->can_classify__( $hash ) );
}
***************
*** 189,192 ****
--- 189,209 ----
test_assert_equal( $b->classify( $session, 'TestMailParse007.msg' ), 'personal' );
+ # Now let's see whether the words in one of the reclassified messages
+ # actually ended up in the corpus
+
+ my %words;
+
+ open WORDS, "<TestMailParse013.wrd";
+ while ( <WORDS> ) {
+ if ( /(.+) (\d+)/ ) {
+ $words{$1} = $2;
+ }
+ }
+ close WORDS;
+
+ foreach my $word (keys %words) {
+ test_assert( $b->get_count_for_word( $session, 'other', $word ) > 0, "other: $word $words{$word}" );
+ }
+
$im->disconnect_folders__();
***************
*** 554,557 ****
--- 571,603 ----
test_assert_equal( $tmpl->param( 'IMAP_expunge_is_checked' ), '' );
test_assert_equal( $tmpl->param( 'IMAP_interval', '99' ) );
+
+ # We now will have to test validate_item.
+ my $form = {};
+ $tmpl = HTML::Template->new( filename => '../skins/default/imap-connection-details.thtml' );
+ $form->{update_imap_0_connection_details} = 1;
+ $form->{imap_hostname} = 'hostname';
+ $form->{imap_port} = 123;
+ $form->{imap_login} = 'username';
+ $form->{imap_password} = 'secret';
+ $form->{imap_use_ssl} = 1;
+ $im->validate_item( 'imap_0_connection_details', $tmpl, $language, $form );
+ test_assert_equal( $im->config_( 'use_ssl' ), 1 );
+ test_assert_equal( $im->config_( 'password' ), 'secret' );
+ test_assert_equal( $im->config_( 'login' ), 'username' );
+ test_assert_equal( $im->config_( 'port' ), 123 );
+ test_assert_equal( $im->config_( 'hostname' ), 'hostname' );
+
+ $form = {};
+ $tmpl = HTML::Template->new( filename => '../skins/default/imap-watch-folders.thtml' );
+ $form->{imap_folder_1} = 'first watched folder';
+ $form->{imap_folder_2} = 'second watched folder';
+ $form->{update_imap_1_watch_folders} = 1;
+ $im->watched_folders__( '1', '2' );
+ $im->validate_item( 'imap_1_watch_folders', $tmpl, $language, $form );
+ test_assert_equal( $im->{folder_change_flag__}, 1 );
+ my @folders = $im->watched_folders__();
+ test_assert_equal( scalar @folders, 2 );
+ test_assert_equal( $folders[0], 'first watched folder' );
+ test_assert_equal( $folders[1], 'second watched folder' );
}
|