Mercurial > hg > nginx-tests
comparison mail_pop3.t @ 1111:6c2538ad642d
Tests: auth external in mail is explicitly enabled since 1.11.9.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 12 Jan 2017 19:23:14 +0300 |
parents | b9b115a2a28d |
children | 2634d0ef48d3 |
comparison
equal
deleted
inserted
replaced
1110:b9b115a2a28d | 1111:6c2538ad642d |
---|---|
24 select STDERR; $| = 1; | 24 select STDERR; $| = 1; |
25 select STDOUT; $| = 1; | 25 select STDOUT; $| = 1; |
26 | 26 |
27 local $SIG{PIPE} = 'IGNORE'; | 27 local $SIG{PIPE} = 'IGNORE'; |
28 | 28 |
29 my $t = Test::Nginx->new()->has(qw/mail pop3 http rewrite/)->plan(18) | 29 my $t = Test::Nginx->new()->has(qw/mail pop3 http rewrite/) |
30 ->write_file_expand('nginx.conf', <<'EOF'); | 30 ->write_file_expand('nginx.conf', <<'EOF'); |
31 | 31 |
32 %%TEST_GLOBALS%% | 32 %%TEST_GLOBALS%% |
33 | 33 |
34 daemon off; | 34 daemon off; |
41 auth_http http://127.0.0.1:8080/mail/auth; | 41 auth_http http://127.0.0.1:8080/mail/auth; |
42 | 42 |
43 server { | 43 server { |
44 listen 127.0.0.1:8110; | 44 listen 127.0.0.1:8110; |
45 protocol pop3; | 45 protocol pop3; |
46 pop3_auth plain apop cram-md5; | 46 pop3_auth plain apop cram-md5 external; |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 http { | 50 http { |
51 %%TEST_GLOBALS_HTTP%% | 51 %%TEST_GLOBALS_HTTP%% |
90 } | 90 } |
91 | 91 |
92 EOF | 92 EOF |
93 | 93 |
94 $t->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon); | 94 $t->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon); |
95 $t->run()->waitforsocket('127.0.0.1:' . port(8111)); | 95 $t->try_run('no auth external')->plan(18); |
96 | |
97 $t->waitforsocket('127.0.0.1:' . port(8111)); | |
96 | 98 |
97 ############################################################################### | 99 ############################################################################### |
98 | 100 |
99 my $s = Test::Nginx::POP3->new(); | 101 my $s = Test::Nginx::POP3->new(); |
100 $s->ok('greeting'); | 102 $s->ok('greeting'); |
163 $s->check(qr/\+ /, 'auth cram-md5 challenge'); | 165 $s->check(qr/\+ /, 'auth cram-md5 challenge'); |
164 | 166 |
165 $s->send(encode_base64('test@example.com ' . ('0' x 32), '')); | 167 $s->send(encode_base64('test@example.com ' . ('0' x 32), '')); |
166 $s->ok('auth cram-md5'); | 168 $s->ok('auth cram-md5'); |
167 | 169 |
168 TODO: { | |
169 local $TODO = 'not yet' unless $t->has_version('1.11.6'); | |
170 | |
171 # auth external | 170 # auth external |
172 | 171 |
173 $s = Test::Nginx::POP3->new(); | 172 $s = Test::Nginx::POP3->new(); |
174 $s->read(); | 173 $s->read(); |
175 | 174 |
185 $s->read(); | 184 $s->read(); |
186 | 185 |
187 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', '')); | 186 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', '')); |
188 $s->ok('auth external with username'); | 187 $s->ok('auth external with username'); |
189 | 188 |
190 } | |
191 | |
192 ############################################################################### | 189 ############################################################################### |