Mercurial > hg > nginx-tests
changeset 323:d48de852157c
Tests: auth_request assorted fixes.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 21 Aug 2013 19:56:00 +0400 |
parents | 67c348ba1768 |
children | 61071d7d28c9 |
files | auth_request.t auth_request_set.t lib/Test/Nginx.pm |
diffstat | 3 files changed, 13 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/auth_request.t Wed Aug 21 19:22:06 2013 +0400 +++ b/auth_request.t Wed Aug 21 19:56:00 2013 +0400 @@ -9,9 +9,9 @@ use warnings; use strict; -use Socket qw/ CRLF /; +use Test::More; -use Test::More; +use Socket qw/ CRLF /; BEGIN { use FindBin; chdir($FindBin::Bin); } @@ -25,14 +25,13 @@ my $t = Test::Nginx->new() ->has(qw/http rewrite proxy fastcgi auth_basic auth_request/) - ->plan(18); + ->plan(17); $t->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% -master_process off; -daemon off; +daemon off; events { } @@ -135,8 +134,6 @@ ############################################################################### -pass('runs'); - like(http_get('/open'), qr/ 404 /, 'auth open'); like(http_get('/unauthorized'), qr/ 401 /, 'auth unauthorized'); like(http_get('/forbidden'), qr/ 403 /, 'auth forbidden'); @@ -187,8 +184,8 @@ ############################################################################### sub http_get_auth { - my ($url, %extra) = @_; - return http(<<EOF, %extra); + my ($url, %extra) = @_; + return http(<<EOF, %extra); GET $url HTTP/1.0 Host: localhost Authorization: Basic dXNlcjpzZWNyZXQ= @@ -203,7 +200,7 @@ "Host: localhost" . CRLF . "Content-Length: 10" . CRLF . CRLF . - "1234567890"; + "1234567890"; return http($p, %extra); } @@ -215,7 +212,7 @@ "Host: localhost" . CRLF . "Content-Length: 10240" . CRLF . CRLF . - ("1234567890" x 1024); + ("1234567890" x 1024); return http($p, %extra); }
--- a/auth_request_set.t Wed Aug 21 19:22:06 2013 +0400 +++ b/auth_request_set.t Wed Aug 21 19:56:00 2013 +0400 @@ -9,8 +9,6 @@ use warnings; use strict; -use Socket qw/ CRLF /; - use Test::More; BEGIN { use FindBin; chdir($FindBin::Bin); } @@ -23,15 +21,14 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http rewrite auth_request/) +my $t = Test::Nginx->new()->has(qw/http rewrite proxy auth_request/) ->plan(6); $t->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% -master_process off; -daemon off; +daemon off; events { } @@ -133,7 +130,7 @@ like(http_get('/t3.html'), qr/X-Set-Username: username/, 'set after named location'); like(http_get('/t4.html'), qr/X-Set-Username: username2/, - 'set on second auth'); + 'set on second auth'); # there are two variables with set_handler: $args and $limit_rate # we do test $args as it's a bit more simple thing to do
--- a/lib/Test/Nginx.pm Wed Aug 21 19:22:06 2013 +0400 +++ b/lib/Test/Nginx.pm Wed Aug 21 19:56:00 2013 +0400 @@ -79,6 +79,8 @@ mail => '--with-mail(?!\S)', flv => '--with-http_flv_module', perl => '--with-http_perl_module', + auth_request + => '--with-http_auth_request_module', charset => '(?s)^(?!.*--without-http_charset_module)', gzip => '(?s)^(?!.*--without-http_gzip_module)', ssi => '(?s)^(?!.*--without-http_ssi_module)',