comparison mail_imap.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 766bcbb632ee
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 imap http rewrite/)->plan(14) 29 my $t = Test::Nginx->new()->has(qw/mail imap 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:8143; 44 listen 127.0.0.1:8143;
45 protocol imap; 45 protocol imap;
46 imap_auth plain cram-md5; 46 imap_auth plain 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::IMAP::imap_test_daemon); 94 $t->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon);
95 $t->run()->waitforsocket('127.0.0.1:' . port(8144)); 95 $t->try_run('no auth external')->plan(14);
96
97 $t->waitforsocket('127.0.0.1:' . port(8144));
96 98
97 ############################################################################### 99 ###############################################################################
98 100
99 my $s = Test::Nginx::IMAP->new(); 101 my $s = Test::Nginx::IMAP->new();
100 $s->ok('greeting'); 102 $s->ok('greeting');
146 $s->check(qr/\+ /, 'auth cram-md5 challenge'); 148 $s->check(qr/\+ /, 'auth cram-md5 challenge');
147 149
148 $s->send(encode_base64('test@example.com ' . ('0' x 32), '')); 150 $s->send(encode_base64('test@example.com ' . ('0' x 32), ''));
149 $s->ok('auth cram-md5'); 151 $s->ok('auth cram-md5');
150 152
151 TODO: {
152 local $TODO = 'not yet' unless $t->has_version('1.11.6');
153
154 # auth external 153 # auth external
155 154
156 $s = Test::Nginx::IMAP->new(); 155 $s = Test::Nginx::IMAP->new();
157 $s->read(); 156 $s->read();
158 157
168 $s->read(); 167 $s->read();
169 168
170 $s->send('1 AUTHENTICATE EXTERNAL ' . encode_base64('test@example.com', '')); 169 $s->send('1 AUTHENTICATE EXTERNAL ' . encode_base64('test@example.com', ''));
171 $s->ok('auth external with username'); 170 $s->ok('auth external with username');
172 171
173 }
174
175 ############################################################################### 172 ###############################################################################