# HG changeset patch # User Sergey Kandaurov # Date 1490100141 -10800 # Node ID ccf134a800aea3c35befd8431365be4715e254ab # Parent b1c2857d2e977d6c2f47d7e74a95284a2cff7216 Tests: added Location tests with alias for dav and static modules. diff --git a/dav.t b/dav.t --- a/dav.t +++ b/dav.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http dav/)->plan(15); +my $t = Test::Nginx->new()->has(qw/http dav/)->plan(18); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -42,6 +42,11 @@ http { location / { dav_methods PUT DELETE MKCOL COPY MOVE; } + + location /i/ { + alias %%TESTDIR%%/; + dav_methods PUT DELETE MKCOL COPY MOVE; + } } } @@ -144,4 +149,16 @@ like($r, qr/204 No Content/, 'copy file is(-s $t->testdir() . '/file-moved escape', 10, 'file copied unescaped'); +$r = http(<testdir() . '/alias', 10, 'put alias size'); + ############################################################################### diff --git a/http_absolute_redirect.t b/http_absolute_redirect.t --- a/http_absolute_redirect.t +++ b/http_absolute_redirect.t @@ -52,6 +52,10 @@ http { location /return301 { return 301 /redirect; } + + location /i/ { + alias %%TESTDIR%%/; + } } server { @@ -67,6 +71,10 @@ http { location /return301 { return 301 /redirect; } + + location /i/ { + alias %%TESTDIR%%/; + } } } @@ -74,17 +82,19 @@ EOF mkdir($t->testdir() . '/dir'); -$t->try_run('no absolute_redirect')->plan(6); +$t->try_run('no absolute_redirect')->plan(8); ############################################################################### my $p = port(8080); like(get('on', '/dir'), qr!Location: http://on:$p/dir/!, 'directory'); +like(get('on', '/i/dir'), qr!Location: http://on:$p/i/dir/!, 'directory alias'); like(get('on', '/auto'), qr!Location: http://on:$p/auto/!, 'auto'); like(get('on', '/return301'), qr!Location: http://on:$p/redirect!, 'return'); like(get('off', '/dir'), qr!Location: /dir/!, 'off directory'); +like(get('off', '/i/dir'), qr!Location: /i/dir/!, 'off directory alias'); like(get('off', '/auto'), qr!Location: /auto/!, 'off auto'); like(get('off', '/return301'), qr!Location: /redirect!, 'off return');