From: Manni H. <man...@us...> - 2008-05-17 13:35:40
|
Update of /cvsroot/popfile/engine/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31012/tests Modified Files: Tag: b0_22_2 TestIMAP.tst IMAP_test_server.pl Log Message: Add a test for unsolicited IMAP server responses Index: TestIMAP.tst =================================================================== RCS file: /cvsroot/popfile/engine/tests/TestIMAP.tst,v retrieving revision 1.3.4.17 retrieving revision 1.3.4.18 diff -C2 -d -r1.3.4.17 -r1.3.4.18 *** TestIMAP.tst 18 Apr 2008 14:33:54 -0000 1.3.4.17 --- TestIMAP.tst 17 May 2008 13:35:43 -0000 1.3.4.18 *************** *** 256,259 **** --- 256,268 ---- test_assert_equal( $im->config_('uidvalidities'), $uidvalis ); + # What happens when we get unsolicited responses from the server? + $im->disconnect_folders__(); + $im->log_( 0, "---- Testing unsolicited BYE response" ); + $im->config_( 'login', 'unsolicitedBYE' ); + $im->{last_update__} = 0; + $im->service(); + test_assert( ! %{$im->{folders__}}, 'Folder hash is empty' ); + + # Check what happens when we time out $im->log_( 0, "---- Testing time-out behaviour for the module." ); Index: IMAP_test_server.pl =================================================================== RCS file: /cvsroot/popfile/engine/tests/IMAP_test_server.pl,v retrieving revision 1.2.4.5 retrieving revision 1.2.4.6 diff -C2 -d -r1.2.4.5 -r1.2.4.6 *** IMAP_test_server.pl 18 Apr 2008 14:33:54 -0000 1.2.4.5 --- IMAP_test_server.pl 17 May 2008 13:35:43 -0000 1.2.4.6 *************** *** 77,80 **** --- 77,81 ---- my $uidvalidity = 1; my $time_out_at = -1; + my $unsolicited = ''; *************** *** 252,260 **** } elsif ( $user =~ /^duplicateMessage/ ) { ! } elsif ( $user =~ /^timeOut(\d+)$/ ) { $time_out_at = $1; } } --- 253,264 ---- } elsif ( $user =~ /^duplicateMessage/ ) { ! # TODO: something seems to be missing here } elsif ( $user =~ /^timeOut(\d+)$/ ) { $time_out_at = $1; } + elsif ( $user =~ /unsolicited(.+)$/ ) { + $unsolicited = $1; + } } *************** *** 310,315 **** # NOOP if ( $command =~ /^NOOP/ ) { ! print $client "$tag OK NOOP complete.$eol"; ! return; } --- 314,326 ---- # NOOP if ( $command =~ /^NOOP/ ) { ! if ( $unsolicited ) { ! print $client "* $unsolicited$eol"; ! $client->shutdown( 2 ); ! return; ! } ! else { ! print $client "$tag OK NOOP complete.$eol"; ! return; ! } } |