# HG changeset patch # User Sergey Kandaurov # Date 1377100560 -14400 # Node ID d48de852157c7a2a5ca78152e1e82e21665feeda # Parent 67c348ba1768893a5eee9ce582ea37c1ec60aaeb Tests: auth_request assorted fixes. diff --git a/auth_request.t b/auth_request.t --- a/auth_request.t +++ b/auth_request.t @@ -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 @@ select STDOUT; $| = 1; 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 @@ EOF ############################################################################### -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 @@ SKIP: { ############################################################################### sub http_get_auth { - my ($url, %extra) = @_; - return http(<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('/t2.html'), qr/X-Set-User 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 diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm --- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm @@ -79,6 +79,8 @@ sub has_module($) { 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)',