Changeset 1110:b9b115a2a28d in nginx-tests


Ignore:
Timestamp:
01/12/17 10:02:23 (11 months ago)
Author:
Sergey Kandaurov <pluknet@…>
Branch:
default
Message:

Tests: auth external mail tests.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mail_imap.t

    r1109 r1110  
    2727local $SIG{PIPE} = 'IGNORE';
    2828
    29 my $t = Test::Nginx->new()->has(qw/mail imap http rewrite/)->plan(11)
     29my $t = Test::Nginx->new()->has(qw/mail imap http rewrite/)->plan(14)
    3030        ->write_file_expand('nginx.conf', <<'EOF');
    3131
     
    7070            set $userpass "$http_auth_user:$http_auth_salt:$http_auth_pass";
    7171            if ($userpass ~ '^test@example.com:<.*@.*>:0{32}$') {
     72                set $reply OK;
     73                set $passw secret;
     74            }
     75
     76            set $userpass "$http_auth_method:$http_auth_user:$http_auth_pass";
     77            if ($userpass ~ '^external:test@example.com:$') {
    7278                set $reply OK;
    7379                set $passw secret;
     
    143149$s->ok('auth cram-md5');
    144150
     151TODO: {
     152local $TODO = 'not yet' unless $t->has_version('1.11.6');
     153
     154# auth external
     155
     156$s = Test::Nginx::IMAP->new();
     157$s->read();
     158
     159$s->send('1 AUTHENTICATE EXTERNAL');
     160$s->check(qr/\+ VXNlcm5hbWU6/, 'auth external challenge');
     161
     162$s->send(encode_base64('test@example.com', ''));
     163$s->ok('auth external');
     164
     165# auth external with username
     166
     167$s = Test::Nginx::IMAP->new();
     168$s->read();
     169
     170$s->send('1 AUTHENTICATE EXTERNAL ' . encode_base64('test@example.com', ''));
     171$s->ok('auth external with username');
     172
     173}
     174
    145175###############################################################################
  • mail_pop3.t

    r1109 r1110  
    2727local $SIG{PIPE} = 'IGNORE';
    2828
    29 my $t = Test::Nginx->new()->has(qw/mail pop3 http rewrite/)->plan(15)
     29my $t = Test::Nginx->new()->has(qw/mail pop3 http rewrite/)->plan(18)
    3030        ->write_file_expand('nginx.conf', <<'EOF');
    3131
     
    7070            set $userpass "$http_auth_user:$http_auth_salt:$http_auth_pass";
    7171            if ($userpass ~ '^test@example.com:<.*@.*>:0{32}$') {
     72                set $reply OK;
     73                set $passw secret;
     74            }
     75
     76            set $userpass "$http_auth_method:$http_auth_user:$http_auth_pass";
     77            if ($userpass ~ '^external:test@example.com:$') {
    7278                set $reply OK;
    7379                set $passw secret;
     
    160166$s->ok('auth cram-md5');
    161167
     168TODO: {
     169local $TODO = 'not yet' unless $t->has_version('1.11.6');
     170
     171# auth external
     172
     173$s = Test::Nginx::POP3->new();
     174$s->read();
     175
     176$s->send('AUTH EXTERNAL');
     177$s->check(qr/\+ VXNlcm5hbWU6/, 'auth external challenge');
     178
     179$s->send(encode_base64('test@example.com', ''));
     180$s->ok('auth external');
     181
     182# auth external with username
     183
     184$s = Test::Nginx::POP3->new();
     185$s->read();
     186
     187$s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', ''));
     188$s->ok('auth external with username');
     189
     190}
     191
    162192###############################################################################
  • mail_smtp.t

    r1109 r1110  
    2828local $SIG{PIPE} = 'IGNORE';
    2929
    30 my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/)->plan(27)
     30my $t = Test::Nginx->new()->has(qw/mail smtp http rewrite/)->plan(30)
    3131        ->write_file_expand('nginx.conf', <<'EOF');
    3232
     
    7171            set $userpass "$http_auth_user:$http_auth_salt:$http_auth_pass";
    7272            if ($userpass ~ '^test@example.com:<.*@.*>:0{32}$') {
     73                set $reply OK;
     74            }
     75
     76            set $userpass "$http_auth_method:$http_auth_user:$http_auth_pass";
     77            if ($userpass ~ '^external:test@example.com:$') {
    7378                set $reply OK;
    7479            }
     
    157162$s->authok('auth cram-md5');
    158163
     164TODO: {
     165local $TODO = 'not yet' unless $t->has_version('1.11.6');
     166
     167# Try auth external
     168
     169$s = Test::Nginx::SMTP->new();
     170$s->read();
     171$s->send('EHLO example.com');
     172$s->read();
     173
     174$s->send('AUTH EXTERNAL');
     175$s->check(qr/^334 VXNlcm5hbWU6/, 'auth external challenge');
     176$s->send(encode_base64('test@example.com', ''));
     177$s->ok('auth external');
     178
     179# Try auth external with username
     180
     181$s = Test::Nginx::SMTP->new();
     182$s->read();
     183$s->send('EHLO example.com');
     184$s->read();
     185
     186$s->send('AUTH EXTERNAL ' . encode_base64('test@example.com', ''));
     187$s->ok('auth external with username');
     188
     189}
     190
    159191# Try auth plain with pipelining
    160192
Note: See TracChangeset for help on using the changeset viewer.