Mercurial > hg > nginx-tests
comparison auth_request.t @ 1343:2ff483941037
Tests: added njs http internalRedirect() method tests.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Wed, 13 Jun 2018 14:53:43 +0300 |
parents | 196d33c2bb45 |
children | 856ab7671404 |
comparison
equal
deleted
inserted
replaced
1342:5833f3b7a884 | 1343:2ff483941037 |
---|---|
54 auth_request /auth-open; | 54 auth_request /auth-open; |
55 } | 55 } |
56 location = /auth-open { | 56 location = /auth-open { |
57 return 204; | 57 return 204; |
58 } | 58 } |
59 | |
60 location /auth_file { | |
61 auth_request /file/t; | |
62 } | |
63 | |
64 location /file/ { | |
65 alias %%TESTDIR%%/; | |
66 } | |
67 | |
59 | 68 |
60 location /open-static { | 69 location /open-static { |
61 auth_request /auth-open-static; | 70 auth_request /auth-open-static; |
62 } | 71 } |
63 location = /auth-open-static { | 72 location = /auth-open-static { |
142 EOF | 151 EOF |
143 | 152 |
144 $t->write_file('htpasswd', 'user:{PLAIN}secret' . "\n"); | 153 $t->write_file('htpasswd', 'user:{PLAIN}secret' . "\n"); |
145 $t->write_file('auth-basic', 'INVISIBLE'); | 154 $t->write_file('auth-basic', 'INVISIBLE'); |
146 $t->write_file('auth-open-static', 'INVISIBLE'); | 155 $t->write_file('auth-open-static', 'INVISIBLE'); |
156 $t->write_file('t', '["SEE-THIS"]'); | |
147 $t->run(); | 157 $t->run(); |
148 | 158 |
149 ############################################################################### | 159 ############################################################################### |
150 | 160 |
161 like(http_get('/auth_file'), qr/ 200 /, 'auth file'); | |
151 like(http_get('/open'), qr/ 404 /, 'auth open'); | 162 like(http_get('/open'), qr/ 404 /, 'auth open'); |
152 like(http_get('/unauthorized'), qr/ 401 /, 'auth unauthorized'); | 163 like(http_get('/unauthorized'), qr/ 401 /, 'auth unauthorized'); |
153 like(http_get('/forbidden'), qr/ 403 /, 'auth forbidden'); | 164 like(http_get('/forbidden'), qr/ 403 /, 'auth forbidden'); |
154 like(http_get('/error'), qr/ 500 /, 'auth error'); | 165 like(http_get('/error'), qr/ 500 /, 'auth error'); |
155 like(http_get('/off'), qr/ 404 /, 'auth off'); | 166 like(http_get('/off'), qr/ 404 /, 'auth off'); |
167 | |
156 | 168 |
157 like(http_post('/open'), qr/ 404 /, 'auth post open'); | 169 like(http_post('/open'), qr/ 404 /, 'auth post open'); |
158 like(http_post('/unauthorized'), qr/ 401 /, 'auth post unauthorized'); | 170 like(http_post('/unauthorized'), qr/ 401 /, 'auth post unauthorized'); |
159 | 171 |
160 like(http_get('/open-static'), qr/ 404 /, 'auth open static'); | 172 like(http_get('/open-static'), qr/ 404 /, 'auth open static'); |