changeset 1719:53a801bf4d0b

Tests: auth_basic_user_file variable tests with conf_prefix.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 30 Jun 2021 23:48:45 +0300
parents 672018971a62
children efc502e696b0
files auth_basic.t
diffstat 1 files changed, 14 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(21)
+my $t = Test::Nginx->new()->has(qw/http auth_basic/)->plan(24)
 	->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
@@ -48,6 +48,12 @@ http {
                 auth_basic off;
                 alias %%TESTDIR%%/;
             }
+
+            location /var {
+                # prepended with conf_prefix
+                auth_basic_user_file $arg_f;
+                alias %%TESTDIR%%/;
+	    }
         }
     }
 }
@@ -112,6 +118,13 @@ like(http_get_auth('/', 'sha3', '1'), qr
 like(http_get_auth('/', 'notfound', '1'), qr!401 Unauthorized!, 'not found');
 like(http_get('/inner/'), qr!SEETHIS!, 'inner off');
 
+like(http_get_auth('/var/?f=htpasswd', 'apr1', 'password'), qr!SEETHIS!,
+	'user file variable');
+unlike(http_get_auth('/var/?f=nx', 'apr1', 'password'), qr!SEETHIS!,
+	'user file variable not found');
+unlike(http_get_auth('/var/', 'apr1', 'password'), qr!SEETHIS!,
+	'user file variable bad value');
+
 ###############################################################################
 
 sub http_get_auth {