comparison mail_pop3.t @ 1146:2634d0ef48d3

Tests: mail capability tests.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 06 Mar 2017 19:28:04 +0300
parents 6c2538ad642d
children 57673c7257a3
comparison
equal deleted inserted replaced
1145:f193664e06d8 1146:2634d0ef48d3
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->try_run('no auth external')->plan(18); 95 $t->try_run('no auth external')->plan(20);
96 96
97 $t->waitforsocket('127.0.0.1:' . port(8111)); 97 $t->waitforsocket('127.0.0.1:' . port(8111));
98 98
99 ############################################################################### 99 ###############################################################################
100 100
118 $s->check(qr/^-ERR/, 'apop error'); 118 $s->check(qr/^-ERR/, 'apop error');
119 119
120 $s->send('APOP test@example.com ' . ('0' x 32)); 120 $s->send('APOP test@example.com ' . ('0' x 32));
121 $s->ok('apop'); 121 $s->ok('apop');
122 122
123 # auth capabilities
124
125 $s = Test::Nginx::POP3->new();
126 $s->read();
127
128 $s->send('AUTH');
129 $s->ok('auth');
130
131 TODO: {
132 local $TODO = 'not yet' unless $t->has_version('1.11.11');
133
134 is(get_auth_caps($s), 'PLAIN:LOGIN:CRAM-MD5:EXTERNAL', 'auth capabilities');
135
136 }
137
123 # auth plain 138 # auth plain
124 139
125 $s = Test::Nginx::POP3->new(); 140 $s = Test::Nginx::POP3->new();
126 $s->read(); 141 $s->read();
127 142
185 200
186 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', '')); 201 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', ''));
187 $s->ok('auth external with username'); 202 $s->ok('auth external with username');
188 203
189 ############################################################################### 204 ###############################################################################
205
206 sub get_auth_caps {
207 my ($s) = @_;
208 my @meth;
209
210 while ($s->read() !~ qr/^\./) {
211 push @meth, $1 if /(.*?)\x0d\x0a?/ms;
212 }
213 join ':', @meth;
214 }
215
216 ###############################################################################