Mercurial > hg > nginx-tests
comparison userid_flags.t @ 1596:f42d82b114cd
Tests: added userid_flags tests with "off" and unset values.
While here, do case-insensitive pattern matching.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 29 Sep 2020 10:59:16 +0100 |
parents | a2c6b95d6591 |
children | 5ac6efbe5552 |
comparison
equal
deleted
inserted
replaced
1595:a2c6b95d6591 | 1596:f42d82b114cd |
---|---|
49 userid_flags samesite=strict; | 49 userid_flags samesite=strict; |
50 | 50 |
51 location /many { | 51 location /many { |
52 userid_flags httponly samesite=none secure; | 52 userid_flags httponly samesite=none secure; |
53 } | 53 } |
54 | |
55 location /off { | |
56 userid_flags off; | |
57 } | |
54 } | 58 } |
55 | 59 |
56 location /lax { | 60 location /lax { |
57 userid_flags samesite=lax; | 61 userid_flags samesite=lax; |
58 } | 62 } |
63 | |
64 location /unset { } | |
59 } | 65 } |
60 } | 66 } |
61 | 67 |
62 EOF | 68 EOF |
63 | 69 |
64 $t->write_file('index.html', ''); | 70 $t->write_file('index.html', ''); |
65 $t->write_file('lax', ''); | 71 $t->write_file('lax', ''); |
66 $t->write_file('many', ''); | 72 $t->write_file('many', ''); |
67 $t->try_run('no userid_flags')->plan(3); | 73 $t->try_run('no userid_flags')->plan(5); |
68 | 74 |
69 ############################################################################### | 75 ############################################################################### |
70 | 76 |
71 like(http_get('/'), qr/samesite=strict/, 'strict'); | 77 like(http_get('/'), qr/samesite=strict/i, 'strict'); |
72 like(http_get('/lax'), qr/samesite=lax/, 'lax'); | 78 like(http_get('/lax'), qr/samesite=lax/i, 'lax'); |
73 like(http_get('/many'), qr/secure; httponly; samesite=none/, 'many'); | 79 like(http_get('/many'), qr/secure; httponly; samesite=none/i, 'many'); |
80 unlike(http_get('/off'), qr/(secure|httponly|samesite)/i, 'off'); | |
81 unlike(http_get('/unset'), qr/(secure|httponly|samesite)/i, 'unset'); | |
74 | 82 |
75 ############################################################################### | 83 ############################################################################### |