Mercurial > hg > nginx-tests
annotate mail_smtp.t @ 1587:17b227c271a2
Tests: 4xx and 5xx codes with stale-while-revalidate.
Now these codes do not fall under stale-if-error (enabled by
stale-while-revalidate).
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 14 Aug 2020 13:32:27 +0300 |
parents | 766bcbb632ee |
children | 7d40f2557a45 |
rev | line source |
---|---|
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
2 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
3 # (C) Maxim Dounin |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
4 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
5 # Tests for nginx mail smtp module. |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
6 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 ############################################################################### |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 use warnings; |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
10 use strict; |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 |
27
fb94a224fef2
Tests: add has() functions for feature testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
26
diff
changeset
|
12 use Test::More; |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 use MIME::Base64; |
7
9eb509695651
Tests: drop our own CRLF constant, use Socket's one instead.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5
diff
changeset
|
15 use Socket qw/ CRLF /; |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 |
9
f772e2a1a13f
Tests: change directory to allow runing from outside.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7
diff
changeset
|
17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
f772e2a1a13f
Tests: change directory to allow runing from outside.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7
diff
changeset
|
18 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
19 use lib 'lib'; |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
20 use Test::Nginx; |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
21 use Test::Nginx::SMTP; |
5
4d75bdb05ecf
Tests: some generic code and ssi tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4
diff
changeset
|
22 |
4d75bdb05ecf
Tests: some generic code and ssi tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4
diff
changeset
|
23 ############################################################################### |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
25 select STDERR; $| = 1; |
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
26 select STDOUT; $| = 1; |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 |
96
ecff5407867c
Tests: better handle unexpected connection close from nginx.
Maxim Dounin <mdounin@mdounin.ru>
parents:
72
diff
changeset
|
28 local $SIG{PIPE} = 'IGNORE'; |
ecff5407867c
Tests: better handle unexpected connection close from nginx.
Maxim Dounin <mdounin@mdounin.ru>
parents:
72
diff
changeset
|
29 |
1111
6c2538ad642d
Tests: auth external in mail is explicitly enabled since 1.11.9.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1110
diff
changeset
|
30 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/) |
976
a8b8dd6e8ae1
Tests: changed startup order in mail tests for consistency.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
970
diff
changeset
|
31 ->write_file_expand('nginx.conf', <<'EOF'); |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
32 |
107
1c0ec30614c6
Tests: add TEST_GLOBALS and TEST_GLOBALS_HTTP config chunks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
96
diff
changeset
|
33 %%TEST_GLOBALS%% |
1c0ec30614c6
Tests: add TEST_GLOBALS and TEST_GLOBALS_HTTP config chunks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
96
diff
changeset
|
34 |
249
6a0d934950bc
Tests: remove extra spaces in "daemon off".
Maxim Dounin <mdounin@mdounin.ru>
parents:
166
diff
changeset
|
35 daemon off; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
36 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
37 events { |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
38 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
39 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
40 mail { |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
41 proxy_pass_error_message on; |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
42 auth_http http://127.0.0.1:8080/mail/auth; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
43 xclient off; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
44 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
45 server { |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
46 listen 127.0.0.1:8025; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
47 protocol smtp; |
1111
6c2538ad642d
Tests: auth external in mail is explicitly enabled since 1.11.9.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1110
diff
changeset
|
48 smtp_auth login plain none cram-md5 external; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
49 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
50 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
51 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
52 http { |
107
1c0ec30614c6
Tests: add TEST_GLOBALS and TEST_GLOBALS_HTTP config chunks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
96
diff
changeset
|
53 %%TEST_GLOBALS_HTTP%% |
35
7bf0e8a1d66c
Tests: always define temp paths.
Maxim Dounin <mdounin@mdounin.ru>
parents:
28
diff
changeset
|
54 |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
55 server { |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
56 listen 127.0.0.1:8080; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
57 server_name localhost; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
58 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
59 location = /mail/auth { |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
60 set $reply ERROR; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
61 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
62 if ($http_auth_smtp_to ~ example.com) { |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
63 set $reply OK; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
64 } |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
65 |
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
66 set $userpass "$http_auth_user:$http_auth_pass"; |
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
67 if ($userpass ~ '^test@example.com:secret$') { |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
68 set $reply OK; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
69 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
70 |
1109
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
71 set $userpass "$http_auth_user:$http_auth_salt:$http_auth_pass"; |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
72 if ($userpass ~ '^test@example.com:<.*@.*>:0{32}$') { |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
73 set $reply OK; |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
74 } |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
75 |
1110
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
76 set $userpass "$http_auth_method:$http_auth_user:$http_auth_pass"; |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
77 if ($userpass ~ '^external:test@example.com:$') { |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
78 set $reply OK; |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
79 } |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
80 |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
81 add_header Auth-Status $reply; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
82 add_header Auth-Server 127.0.0.1; |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
83 add_header Auth-Port %%PORT_8026%%; |
17
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
84 add_header Auth-Wait 1; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
85 return 204; |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
86 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
87 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
88 } |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
89 |
7e28c64edf55
Tests: reorganize smtp tests (no real changes).
Maxim Dounin <mdounin@mdounin.ru>
parents:
14
diff
changeset
|
90 EOF |
4
6c41dbb2954f
Tests: run nginx with appropriate config from test itself.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3
diff
changeset
|
91 |
976
a8b8dd6e8ae1
Tests: changed startup order in mail tests for consistency.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
970
diff
changeset
|
92 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon); |
1251
766bcbb632ee
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1111
diff
changeset
|
93 $t->run()->plan(30); |
1111
6c2538ad642d
Tests: auth external in mail is explicitly enabled since 1.11.9.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1110
diff
changeset
|
94 |
6c2538ad642d
Tests: auth external in mail is explicitly enabled since 1.11.9.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1110
diff
changeset
|
95 $t->waitforsocket('127.0.0.1:' . port(8026)); |
976
a8b8dd6e8ae1
Tests: changed startup order in mail tests for consistency.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
970
diff
changeset
|
96 |
4
6c41dbb2954f
Tests: run nginx with appropriate config from test itself.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3
diff
changeset
|
97 ############################################################################### |
6c41dbb2954f
Tests: run nginx with appropriate config from test itself.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3
diff
changeset
|
98 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
99 my $s = Test::Nginx::SMTP->new(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
100 $s->check(qr/^220 /, "greeting"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
101 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
102 $s->send('EHLO example.com'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
103 $s->check(qr/^250 /, "ehlo"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
104 |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
105 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0bad", '')); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
106 $s->check(qr/^5.. /, 'auth plain with bad password'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
107 |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
108 $s->send('AUTH PLAIN ' . encode_base64("\0test\@example.com\0secret", '')); |
69
30d6cce3f0bd
Tests: more checks for 235 code on successful smtp auth.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
109 $s->authok('auth plain'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
110 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 # We are talking to backend from this point |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
113 $s->send('MAIL FROM:<test@example.com> SIZE=100'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
114 $s->ok('mail from after auth'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
116 $s->send('RSET'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
117 $s->ok('rset'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
119 $s->send('MAIL FROM:<test@xn--e1afmkfd.xn--80akhbyknj4f> SIZE=100'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
120 $s->ok("idn mail from (example.test in russian)"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
121 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
122 $s->send('QUIT'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
123 $s->ok("quit"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
124 |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
125 # Try auth login in simple form |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
126 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
127 $s = Test::Nginx::SMTP->new(); |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
128 $s->read(); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
129 $s->send('EHLO example.com'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
130 $s->read(); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
131 |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
132 $s->send('AUTH LOGIN'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
133 $s->check(qr/^334 VXNlcm5hbWU6/, 'auth login simple username challenge'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
134 $s->send(encode_base64('test@example.com', '')); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
135 $s->check(qr/^334 UGFzc3dvcmQ6/, 'auth login simple password challenge'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
136 $s->send(encode_base64('secret', '')); |
69
30d6cce3f0bd
Tests: more checks for 235 code on successful smtp auth.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
137 $s->authok('auth login simple'); |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
138 |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
139 # Try auth plain with username. Details: |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
140 # |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
141 # [MS-XLOGIN]: SMTP Protocol AUTH LOGIN Extension Specification |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
142 # http://download.microsoft.com/download/5/D/D/5DD33FDF-91F5-496D-9884-0A0B0EE698BB/%5BMS-XLOGIN%5D.pdf |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
143 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
144 $s = Test::Nginx::SMTP->new(); |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
145 $s->read(); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
146 $s->send('EHLO example.com'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
147 $s->read(); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
148 |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
149 $s->send('AUTH LOGIN ' . encode_base64('test@example.com', '')); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
150 $s->check(qr/^334 UGFzc3dvcmQ6/, 'auth login with username password challenge'); |
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
151 $s->send(encode_base64('secret', '')); |
60
11e33ba0656a
Tests: check for 235 code on successful smtp auth.
Maxim Dounin <mdounin@mdounin.ru>
parents:
58
diff
changeset
|
152 $s->authok('auth login with username'); |
58
d053b4bf6ec6
Tests: add smtp auth login tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
57
diff
changeset
|
153 |
1109
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
154 # Try auth cram-md5 |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
155 |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
156 $s = Test::Nginx::SMTP->new(); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
157 $s->read(); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
158 $s->send('EHLO example.com'); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
159 $s->read(); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
160 |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
161 $s->send('AUTH CRAM-MD5'); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
162 $s->check(qr/^334 /, 'auth cram-md5 challenge'); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
163 $s->send(encode_base64('test@example.com ' . ('0' x 32), '')); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
164 $s->authok('auth cram-md5'); |
59d5c8ca7e4d
Tests: auth cram-md5 mail tests, pop3 user/pass and apop tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
976
diff
changeset
|
165 |
1110
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
166 # Try auth external |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
167 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
168 $s = Test::Nginx::SMTP->new(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
169 $s->read(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
170 $s->send('EHLO example.com'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
171 $s->read(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
172 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
173 $s->send('AUTH EXTERNAL'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
174 $s->check(qr/^334 VXNlcm5hbWU6/, 'auth external challenge'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
175 $s->send(encode_base64('test@example.com', '')); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
176 $s->ok('auth external'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
177 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
178 # Try auth external with username |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
179 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
180 $s = Test::Nginx::SMTP->new(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
181 $s->read(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
182 $s->send('EHLO example.com'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
183 $s->read(); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
184 |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
185 $s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', '')); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
186 $s->ok('auth external with username'); |
b9b115a2a28d
Tests: auth external mail tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1109
diff
changeset
|
187 |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
188 # Try auth plain with pipelining |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
189 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
190 $s = Test::Nginx::SMTP->new(); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
191 $s->read(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
192 $s->send('EHLO example.com'); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
193 $s->read(); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
194 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
195 $s->send('INVALID COMMAND WITH ARGUMENTS' . CRLF |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
196 . 'RSET'); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
197 $s->read(); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
198 $s->ok('pipelined rset after invalid command'); |
1
c731d50dd6b1
Tests: check pipelining after invalid command.
Maxim Dounin <mdounin@mdounin.ru>
parents:
0
diff
changeset
|
199 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
200 $s->send('AUTH PLAIN ' |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
201 . encode_base64("\0test\@example.com\0bad", '') . CRLF |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
202 . 'MAIL FROM:<test@example.com> SIZE=100'); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
203 $s->read(); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
204 $s->ok('mail from after failed pipelined auth'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
205 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
206 $s->send('AUTH PLAIN ' |
56
573c8293ac38
Tests: fix smtp auth plain tests to check username.
Maxim Dounin <mdounin@mdounin.ru>
parents:
45
diff
changeset
|
207 . encode_base64("\0test\@example.com\0secret", '') . CRLF |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
208 . 'MAIL FROM:<test@example.com> SIZE=100'); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
209 $s->read(); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
210 $s->ok('mail from after pipelined auth'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
211 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
212 # Try auth none |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
213 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
214 $s = Test::Nginx::SMTP->new(); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
215 $s->read(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
216 $s->send('EHLO example.com'); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
217 $s->read(); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
218 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
219 $s->send('MAIL FROM:<test@example.com> SIZE=100'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
220 $s->ok('auth none - mail from'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
221 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
222 $s->send('RCPT TO:<test@example.com>'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
223 $s->ok('auth none - rcpt to'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
224 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
225 $s->send('RSET'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
226 $s->ok('auth none - rset, should go to backend'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
227 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
228 # Auth none with pipelining |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
229 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
230 $s = Test::Nginx::SMTP->new(); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
231 $s->read(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
232 $s->send('EHLO example.com'); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
233 $s->read(); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
234 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
235 $s->send('MAIL FROM:<test@example.com> SIZE=100' . CRLF |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
236 . 'RCPT TO:<test@example.com>' . CRLF |
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
237 . 'RSET'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
238 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
239 $s->ok('pipelined mail from'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
240 $s->ok('pipelined rcpt to'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
241 $s->ok('pipelined rset'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
242 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
243 # Connection must stay even if error returned to rcpt to command |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
244 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
245 $s = Test::Nginx::SMTP->new(); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
246 $s->read(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
247 $s->send('EHLO example.com'); |
57
b5b4271554b0
Test: use TODO for smtp pipelining tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
56
diff
changeset
|
248 $s->read(); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
249 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
250 $s->send('MAIL FROM:<test@example.com> SIZE=100'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
251 $s->read(); # skip mail from reply |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
252 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
253 $s->send('RCPT TO:<example.com>'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
254 $s->check(qr/^5.. /, "bad rcpt to"); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
255 |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
256 $s->send('RCPT TO:<test@example.com>'); |
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
257 $s->ok('good rcpt to'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
258 |
343
e7dc8f4d0a4b
Tests: whitespace and spelling fixes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
259 # Make sure command split into many packets processed correctly |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
260 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
261 $s = Test::Nginx::SMTP->new(); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
262 $s->read(); |
2
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
263 |
33cb557f69d4
Tests: smtp pipelining is here, remove todo flags.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1
diff
changeset
|
264 $s->print('HEL'); |
14
d4b74207a627
Tests: refactor common functions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
9
diff
changeset
|
265 $s->send('O example.com'); |
343
e7dc8f4d0a4b
Tests: whitespace and spelling fixes.
Sergey Kandaurov <pluknet@nginx.com>
parents:
249
diff
changeset
|
266 $s->ok('split command'); |
0
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
267 |
de28d9f761be
Tests for nginx. Initial smtp testing.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
268 ############################################################################### |