Mercurial > hg > nginx-tests
comparison mail_smtp_greeting_delay.t @ 148:b714d6df958c
Tests: rename some tests for better sorting.
Use underscore instead of dash. Addtionally, rename some tests to better
match "module" + "details" scheme used: use "http_" prefix for http core
module tests, use "mail_" prefix for mail module tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 04 Mar 2011 16:07:15 +0300 |
parents | smtp-greeting-delay.t@8ac1faaddd2c |
children | b5d0fcb02980 |
comparison
equal
deleted
inserted
replaced
147:fd865ada95c8 | 148:b714d6df958c |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # (C) Maxim Dounin | |
4 | |
5 ############################################################################### | |
6 | |
7 use warnings; | |
8 use strict; | |
9 | |
10 use Test::More; | |
11 | |
12 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
13 | |
14 use lib 'lib'; | |
15 use Test::Nginx; | |
16 use Test::Nginx::SMTP; | |
17 | |
18 ############################################################################### | |
19 | |
20 select STDERR; $| = 1; | |
21 select STDOUT; $| = 1; | |
22 | |
23 my $t = Test::Nginx->new()->has(qw/mail smtp http/)->plan(2) | |
24 ->write_file_expand('nginx.conf', <<'EOF')->run(); | |
25 | |
26 %%TEST_GLOBALS%% | |
27 | |
28 master_process off; | |
29 daemon off; | |
30 | |
31 events { | |
32 } | |
33 | |
34 mail { | |
35 proxy_pass_error_message on; | |
36 auth_http http://127.0.0.1:8080/mail/auth; | |
37 xclient off; | |
38 | |
39 server { | |
40 listen 127.0.0.1:8025; | |
41 protocol smtp; | |
42 smtp_greeting_delay 100ms; | |
43 } | |
44 } | |
45 | |
46 http { | |
47 # stub to avoid SIGSEGV when perl module compiled in, <= 0.7.30 | |
48 } | |
49 | |
50 EOF | |
51 | |
52 ############################################################################### | |
53 | |
54 # With smtp_greeting_delay session expected to be closed after first error | |
55 # message if client sent something before greeting. | |
56 | |
57 my $s = Test::Nginx::SMTP->new(); | |
58 $s->send('HELO example.com'); | |
59 $s->check(qr/^5.. /, "command before greeting - session must be rejected"); | |
60 | |
61 TODO: { | |
62 local $TODO = 'not in official nginx yet'; | |
63 | |
64 ok($s->eof(), "session have to be closed"); | |
65 | |
66 } | |
67 | |
68 ############################################################################### |