Mercurial > hg > nginx-tests
comparison smtp.t @ 58:d053b4bf6ec6
Tests: add smtp auth login tests.
This covers both simple auth login and (not yet supported) auth login with
user name.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 11 Jan 2009 20:43:25 +0300 |
parents | b5b4271554b0 |
children | 11e33ba0656a |
comparison
equal
deleted
inserted
replaced
57:b5b4271554b0 | 58:d053b4bf6ec6 |
---|---|
24 | 24 |
25 select STDERR; $| = 1; | 25 select STDERR; $| = 1; |
26 select STDOUT; $| = 1; | 26 select STDOUT; $| = 1; |
27 | 27 |
28 my $t = Test::Nginx->new() | 28 my $t = Test::Nginx->new() |
29 ->has('mail')->plan(20) | 29 ->has('mail')->plan(25) |
30 ->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon) | 30 ->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon) |
31 ->write_file_expand('nginx.conf', <<'EOF')->run(); | 31 ->write_file_expand('nginx.conf', <<'EOF')->run(); |
32 | 32 |
33 master_process off; | 33 master_process off; |
34 daemon off; | 34 daemon off; |
109 $s->ok("idn mail from (example.test in russian)"); | 109 $s->ok("idn mail from (example.test in russian)"); |
110 | 110 |
111 $s->send('QUIT'); | 111 $s->send('QUIT'); |
112 $s->ok("quit"); | 112 $s->ok("quit"); |
113 | 113 |
114 # Try auth login in simple form | |
115 | |
116 $s = Test::Nginx::SMTP->new(); | |
117 $s->read(); | |
118 $s->send('EHLO example.com'); | |
119 $s->read(); | |
120 | |
121 $s->send('AUTH LOGIN'); | |
122 $s->check(qr/^334 VXNlcm5hbWU6/, 'auth login simple username challenge'); | |
123 $s->send(encode_base64('test@example.com', '')); | |
124 $s->check(qr/^334 UGFzc3dvcmQ6/, 'auth login simple password challenge'); | |
125 $s->send(encode_base64('secret', '')); | |
126 $s->ok('auth login simple'); | |
127 | |
128 # Try auth plain with username. Details: | |
129 # | |
130 # [MS-XLOGIN]: SMTP Protocol AUTH LOGIN Extension Specification | |
131 # http://download.microsoft.com/download/5/D/D/5DD33FDF-91F5-496D-9884-0A0B0EE698BB/%5BMS-XLOGIN%5D.pdf | |
132 | |
133 TODO: { | |
134 local $TODO = 'not supported yet'; | |
135 | |
136 $s = Test::Nginx::SMTP->new(); | |
137 $s->read(); | |
138 $s->send('EHLO example.com'); | |
139 $s->read(); | |
140 | |
141 $s->send('AUTH LOGIN ' . encode_base64('test@example.com', '')); | |
142 $s->check(qr/^334 UGFzc3dvcmQ6/, 'auth login with username password challenge'); | |
143 $s->send(encode_base64('secret', '')); | |
144 $s->ok('auth login with username'); | |
145 | |
146 } | |
147 | |
114 # Try auth plain with pipelining | 148 # Try auth plain with pipelining |
115 | 149 |
116 TODO: { | 150 TODO: { |
117 local $TODO = 'pipelining not in official nginx'; | 151 local $TODO = 'pipelining not in official nginx'; |
118 | 152 |