Mercurial > hg > nginx-tests
comparison mail_pop3.t @ 1683:994d1b58cbe8
Tests: POP3 pipelining tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 19 May 2021 04:33:07 +0300 |
parents | e6bf510f5e13 |
children | 2a0a6035a1af |
comparison
equal
deleted
inserted
replaced
1682:57ff83315818 | 1683:994d1b58cbe8 |
---|---|
10 use strict; | 10 use strict; |
11 | 11 |
12 use Test::More; | 12 use Test::More; |
13 | 13 |
14 use MIME::Base64; | 14 use MIME::Base64; |
15 use Socket qw/ CRLF /; | |
15 | 16 |
16 BEGIN { use FindBin; chdir($FindBin::Bin); } | 17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
17 | 18 |
18 use lib 'lib'; | 19 use lib 'lib'; |
19 use Test::Nginx; | 20 use Test::Nginx; |
87 } | 88 } |
88 | 89 |
89 EOF | 90 EOF |
90 | 91 |
91 $t->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon); | 92 $t->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon); |
92 $t->run()->plan(20); | 93 $t->run()->plan(28); |
93 | 94 |
94 $t->waitforsocket('127.0.0.1:' . port(8111)); | 95 $t->waitforsocket('127.0.0.1:' . port(8111)); |
95 | 96 |
96 ############################################################################### | 97 ############################################################################### |
97 | 98 |
190 $s = Test::Nginx::POP3->new(); | 191 $s = Test::Nginx::POP3->new(); |
191 $s->read(); | 192 $s->read(); |
192 | 193 |
193 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', '')); | 194 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', '')); |
194 $s->ok('auth external with username'); | 195 $s->ok('auth external with username'); |
196 | |
197 # pipelining | |
198 | |
199 $s = Test::Nginx::POP3->new(); | |
200 $s->read(); | |
201 | |
202 $s->send('INVALID COMMAND WITH ARGUMENTS' . CRLF | |
203 . 'NOOP'); | |
204 $s->check(qr/^-ERR/, 'pipelined invalid command'); | |
205 | |
206 TODO: { | |
207 local $TODO = 'not yet' unless $t->has_version('1.21.0'); | |
208 | |
209 $s->ok('pipelined noop after invalid command'); | |
210 | |
211 } | |
212 | |
213 $s->send('USER test@example.com' . CRLF | |
214 . 'PASS secret' . CRLF | |
215 . 'QUIT'); | |
216 $s->ok('pipelined user'); | |
217 | |
218 TODO: { | |
219 local $TODO = 'not yet' unless $t->has_version('1.21.0'); | |
220 | |
221 $s->ok('pipelined pass'); | |
222 $s->ok('pipelined quit'); | |
223 | |
224 } | |
225 | |
226 $s = Test::Nginx::POP3->new(); | |
227 $s->read(); | |
228 | |
229 $s->send('AUTH LOGIN' . CRLF | |
230 . encode_base64('test@example.com', '') . CRLF | |
231 . encode_base64('secret', '')); | |
232 $s->check(qr/\+ VXNlcm5hbWU6/, 'pipelined auth username challenge'); | |
233 | |
234 TODO: { | |
235 local $TODO = 'not yet' unless $t->has_version('1.21.0'); | |
236 | |
237 $s->check(qr/\+ UGFzc3dvcmQ6/, 'pipelined auth password challenge'); | |
238 $s->ok('pipelined auth'); | |
239 | |
240 } | |
195 | 241 |
196 ############################################################################### | 242 ############################################################################### |
197 | 243 |
198 sub get_auth_caps { | 244 sub get_auth_caps { |
199 my ($s) = @_; | 245 my ($s) = @_; |