Tests: POP3 pipelining tests.
diff --git a/mail_pop3.t b/mail_pop3.t index fb6fc47..db6d3ad 100644 --- a/mail_pop3.t +++ b/mail_pop3.t
@@ -12,6 +12,7 @@ use Test::More; use MIME::Base64; +use Socket qw/ CRLF /; BEGIN { use FindBin; chdir($FindBin::Bin); } @@ -89,7 +90,7 @@ EOF $t->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon); -$t->run()->plan(20); +$t->run()->plan(28); $t->waitforsocket('127.0.0.1:' . port(8111)); @@ -193,6 +194,51 @@ $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', '')); $s->ok('auth external with username'); +# pipelining + +$s = Test::Nginx::POP3->new(); +$s->read(); + +$s->send('INVALID COMMAND WITH ARGUMENTS' . CRLF + . 'NOOP'); +$s->check(qr/^-ERR/, 'pipelined invalid command'); + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.21.0'); + +$s->ok('pipelined noop after invalid command'); + +} + +$s->send('USER test@example.com' . CRLF + . 'PASS secret' . CRLF + . 'QUIT'); +$s->ok('pipelined user'); + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.21.0'); + +$s->ok('pipelined pass'); +$s->ok('pipelined quit'); + +} + +$s = Test::Nginx::POP3->new(); +$s->read(); + +$s->send('AUTH LOGIN' . CRLF + . encode_base64('test@example.com', '') . CRLF + . encode_base64('secret', '')); +$s->check(qr/\+ VXNlcm5hbWU6/, 'pipelined auth username challenge'); + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.21.0'); + +$s->check(qr/\+ UGFzc3dvcmQ6/, 'pipelined auth password challenge'); +$s->ok('pipelined auth'); + +} + ############################################################################### sub get_auth_caps {