changeset 666:64f22e0aaab2

Tests: auth basic tests for merged "off" value and user not found.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 27 Aug 2015 15:19:27 +0300
parents 3a8dc14b98ba
children 0247e314e991
files auth_basic.t
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 {