|
From: <jgr...@us...> - 2003-07-31 23:36:10
|
Update of /cvsroot/popfile/engine/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv9920/tests
Modified Files:
TestPOP3.tst
Log Message:
Add tests for APOP. Note our APOP implementation is not correct. There's a patch that fixes this that I need to examine and incorporate appropriate changes and then we'll need to update the test suite
Index: TestPOP3.tst
===================================================================
RCS file: /cvsroot/popfile/engine/tests/TestPOP3.tst,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** TestPOP3.tst 31 Jul 2003 23:04:34 -0000 1.7
--- TestPOP3.tst 31 Jul 2003 23:36:07 -0000 1.8
***************
*** 90,94 ****
$command =~ s/(\015|\012)//g;
! if ( $command =~ /USER (.*)/i ) {
if ( $1 =~ /(gooduser)/ ) {
print $client "+OK Welcome $1$eol";
--- 90,94 ----
$command =~ s/(\015|\012)//g;
! if ( $command =~ /^USER (.*)/i ) {
if ( $1 =~ /(gooduser)/ ) {
print $client "+OK Welcome $1$eol";
***************
*** 138,142 ****
}
! if ( $command =~ /QUIT/i ) {
print $client "+OK Bye$eol";
last;
--- 138,142 ----
}
! if ( $command =~ /^QUIT/i ) {
print $client "+OK Bye$eol";
last;
***************
*** 222,226 ****
}
! if ( $command =~ /APOP (.*):((.*):)?(.*) (.*)/i ) {
next;
}
--- 222,227 ----
}
! if ( $command =~ /APOP (.*) (.*)/i ) {
! print $client "+OK Welcome APOPer$eol";
next;
}
***************
*** 242,246 ****
}
! return 0;
}
--- 243,247 ----
}
! return 1;
}
***************
*** 331,335 ****
my $now = time;
! while ( $p->service() && ( ( $now + 10 ) > time ) ) {
}
--- 332,336 ----
my $now = time;
! while ( $p->service() && ( ( $now + 15 ) > time ) ) {
}
***************
*** 687,691 ****
close $client;
! # TODO the APOP command
# Test SPA/AUTH commands with no secure server specified
--- 688,722 ----
close $client;
! # Test the APOP command
!
! my $client = IO::Socket::INET->new(
! Proto => "tcp",
! PeerAddr => 'localhost',
! PeerPort => $port );
!
! test_assert( defined( $client ) );
! test_assert( $client->connected );
!
! my $result = <$client>;
! test_assert_equal( $result, "+OK POP3 POPFile (test suite) server ready$eol" );
!
! # Try a connection to a server that does not exist
!
! print $client "APOP 127.0.0.1:8111:gooduser md5$eol";
! $result = <$client>;
! test_assert_equal( $result, "-ERR can't connect to 127.0.0.1:8111$eol" );
!
! # Check that we can connect to the remote POP3 server (should still be waiting
! # for us)
!
! print $client "APOP 127.0.0.1:8110:gooduser md5$eol";
! $result = <$client>;
! test_assert_equal( $result, "+OK Welcome APOPer$eol" );
!
! print $client "QUIT$eol";
! $result = <$client>;
! test_assert_equal( $result, "+OK Bye$eol" );
!
! close $client;
# Test SPA/AUTH commands with no secure server specified
***************
*** 721,724 ****
--- 752,778 ----
# TODO SPA/AUTH tests with good, bad servers
+
+ # Send the remote server a special message that makes it die
+
+ my $client = IO::Socket::INET->new(
+ Proto => "tcp",
+ PeerAddr => 'localhost',
+ PeerPort => $port );
+
+ test_assert( defined( $client ) );
+ test_assert( $client->connected );
+
+ my $result = <$client>;
+ test_assert_equal( $result, "+OK POP3 POPFile (test suite) server ready$eol" );
+
+ print $client "USER 127.0.0.1:8110:gooduser$eol";
+ $result = <$client>;
+ test_assert_equal( $result, "+OK Welcome gooduser$eol" );
+
+ print $client "__QUIT__$eol";
+ $result = <$client>;
+ test_assert_equal( $result, "+OK Bye$eol" );
+
+ close $client;
while ( waitpid( $pid, &WNOHANG ) != $pid ) {
|