changeset 57:b5b4271554b0

Test: use TODO for smtp pipelining tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Sun, 11 Jan 2009 20:33:59 +0300
parents 573c8293ac38
children d053b4bf6ec6
files lib/Test/Nginx/SMTP.pm smtp.t
diffstat 2 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/lib/Test/Nginx/SMTP.pm
+++ b/lib/Test/Nginx/SMTP.pm
@@ -59,12 +59,12 @@ sub read {
 
 sub check {
 	my ($self, $regex, $name) = @_;
-	Test::More::like($self->read(), $regex, $name);
+	Test::More->builder->like($self->read(), $regex, $name);
 }
 
 sub ok {
 	my $self = shift; 
-	$self->check(qr/^2\d\d /, @_);
+	Test::More->builder->like($self->read(), qr/^2\d\d /, @_);
 }
 
 ###############################################################################
--- a/smtp.t
+++ b/smtp.t
@@ -26,7 +26,7 @@ select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()
-	->has('mail')->plan(26)
+	->has('mail')->plan(20)
 	->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon)
 	->write_file_expand('nginx.conf', <<'EOF')->run();
 
@@ -113,11 +113,13 @@ my $s = Test::Nginx::SMTP->new();
 
 # Try auth plain with pipelining
 
-$s = Test::Nginx::SMTP->new();
-$s->check(qr/^220 /, "greeting");
+TODO: {
+local $TODO = 'pipelining not in official nginx';
 
+$s = Test::Nginx::SMTP->new();
+$s->read();
 $s->send('EHLO example.com');
-$s->check(qr/^250 /, "ehlo");
+$s->read();
 
 $s->send('INVALID COMMAND WITH ARGUMENTS' . CRLF
 	. 'RSET');
@@ -136,13 +138,14 @@ my $s = Test::Nginx::SMTP->new();
 $s->read();
 $s->ok('mail from after pipelined auth');
 
+}
+
 # Try auth none
 
 $s = Test::Nginx::SMTP->new();
-$s->check(qr/^220 /, "greeting");
-
+$s->read();
 $s->send('EHLO example.com');
-$s->check(qr/^250 /, "ehlo");
+$s->read();
 
 $s->send('MAIL FROM:<test@example.com> SIZE=100');
 $s->ok('auth none - mail from');
@@ -156,10 +159,9 @@ my $s = Test::Nginx::SMTP->new();
 # Auth none with pipelining
 
 $s = Test::Nginx::SMTP->new();
-$s->check(qr/^220 /, "greeting");
-
+$s->read();
 $s->send('EHLO example.com');
-$s->check(qr/^250 /, "ehlo");
+$s->read();
 
 $s->send('MAIL FROM:<test@example.com> SIZE=100' . CRLF
 	. 'RCPT TO:<test@example.com>' . CRLF
@@ -167,16 +169,20 @@ my $s = Test::Nginx::SMTP->new();
 
 $s->ok('pipelined mail from');
 
+TODO: {
+local $TODO = 'pipelining not in official nginx';
+
 $s->ok('pipelined rcpt to');
 $s->ok('pipelined rset');
 
+}
+
 # Connection must stay even if error returned to rcpt to command
 
 $s = Test::Nginx::SMTP->new();
-$s->read(); # skip greeting
-
+$s->read();
 $s->send('EHLO example.com');
-$s->read(); # skip ehlo reply
+$s->read();
 
 $s->send('MAIL FROM:<test@example.com> SIZE=100');
 $s->read(); # skip mail from reply