# HG changeset patch # User Sergey Kandaurov # Date 1440677967 -10800 # Node ID 64f22e0aaab25ae873fd66cf0f13d2fea29b73f7 # Parent 3a8dc14b98ba936e347ddcce66ce1079dcc557fc Tests: auth basic tests for merged "off" value and user not found. diff --git a/auth_basic.t b/auth_basic.t --- a/auth_basic.t +++ b/auth_basic.t @@ -23,7 +23,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http auth_basic/)->plan(19) +my $t = Test::Nginx->new()->has(qw/http auth_basic/)->plan(21) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -43,6 +43,11 @@ http { location / { auth_basic "closed site"; auth_basic_user_file %%TESTDIR%%/htpasswd; + + location /inner { + auth_basic off; + alias %%TESTDIR%%/; + } } } } @@ -115,6 +120,9 @@ like(http_get_auth('/', 'ssha3', '1'), q like(http_get_auth('/', 'sha2', '1'), qr!401 Unauthorized!, 'sha broken 1'); like(http_get_auth('/', 'sha3', '1'), qr!401 Unauthorized!, 'sha broken 2'); +like(http_get_auth('/', 'notfound', '1'), qr!401 Unauthorized!, 'not found'); +like(http_get('/inner/'), qr!SEETHIS!, 'inner off'); + ############################################################################### sub http_get_auth {