Mercurial > hg > nginx-tests
annotate xslt_params.t @ 1260:eadd24ccfda1
Tests: postponed startup in certain ssl certificate tests on win32.
At least, some win32 hosts exhibit a round-off error or some such in the
notBefore field of the certificate generated before starting nginx, such
that it can be set to the value one second ahead of the current time.
This manifests in spurious test failures due to certificate verify error
with a failure reason "certificate is not yet valid".
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 12 Dec 2017 12:53:53 +0300 |
parents | 1755891577af |
children | 97c8280de681 |
rev | line source |
---|---|
208 | 1 #!/usr/bin/perl |
2 | |
3 # (C) Maxim Dounin | |
4 | |
5 # Tests for nginx xslt filter module. | |
6 | |
7 ############################################################################### | |
8 | |
9 use warnings; | |
10 use strict; | |
11 | |
12 use Test::More; | |
13 | |
14 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
15 | |
16 use lib 'lib'; | |
17 use Test::Nginx; | |
18 | |
19 ############################################################################### | |
20 | |
21 select STDERR; $| = 1; | |
22 select STDOUT; $| = 1; | |
23 | |
24 my $t = Test::Nginx->new()->has(qw/http xslt/); | |
25 | |
26 $t->write_file_expand('nginx.conf', <<'EOF'); | |
27 | |
28 %%TEST_GLOBALS%% | |
29 | |
249
6a0d934950bc
Tests: remove extra spaces in "daemon off".
Maxim Dounin <mdounin@mdounin.ru>
parents:
211
diff
changeset
|
30 daemon off; |
208 | 31 |
32 events { | |
33 } | |
34 | |
35 http { | |
36 %%TEST_GLOBALS_HTTP%% | |
37 | |
38 server { | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
39 listen 127.0.0.1:8080; |
208 | 40 server_name localhost; |
41 | |
42 default_type text/xml; | |
43 | |
44 location /x1 { | |
45 xslt_stylesheet %%TESTDIR%%/test.xslt | |
211
ee8fee3c4ae8
Tests: fix xslt tests for CentOS 5.
Maxim Dounin <mdounin@mdounin.ru>
parents:
208
diff
changeset
|
46 param1='value1':param2=/root param3='value%33'; |
208 | 47 } |
48 location /x2 { | |
49 xslt_stylesheet %%TESTDIR%%/test.xslt; | |
50 xslt_param param1 "'value1'"; | |
211
ee8fee3c4ae8
Tests: fix xslt tests for CentOS 5.
Maxim Dounin <mdounin@mdounin.ru>
parents:
208
diff
changeset
|
51 xslt_param param2 "/root"; |
208 | 52 xslt_string_param param3 "value3"; |
53 } | |
54 location /x3 { | |
55 xslt_stylesheet %%TESTDIR%%/test.xslt | |
211
ee8fee3c4ae8
Tests: fix xslt tests for CentOS 5.
Maxim Dounin <mdounin@mdounin.ru>
parents:
208
diff
changeset
|
56 param1='value1':param2=/root; |
208 | 57 xslt_string_param param3 "value3"; |
58 } | |
59 } | |
60 } | |
61 | |
62 EOF | |
63 | |
64 $t->write_file('test.xslt', <<'EOF'); | |
65 | |
66 <xsl:stylesheet version="1.0" | |
67 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
68 | |
69 <xsl:output method="html"/> | |
70 | |
71 <xsl:param name="param1"/> | |
72 <xsl:param name="param2"/> | |
73 <xsl:param name="param3"/> | |
74 | |
75 <xsl:template match="/"> | |
76 param1=<xsl:value-of select="$param1"/> | |
77 param2=<xsl:value-of select="$param2"/> | |
78 param3=<xsl:value-of select="$param3"/> | |
79 </xsl:template> | |
80 | |
81 </xsl:stylesheet> | |
82 | |
83 EOF | |
84 | |
85 $t->write_file('x1', '<root>data</root>'); | |
86 $t->write_file('x2', '<root>data</root>'); | |
87 $t->write_file('x3', '<root>data</root>'); | |
88 | |
1241
6b4c0c80cd00
Tests: added test for xslt_stylesheet configuration immutability.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
89 $t->run()->plan(4); |
208 | 90 |
91 ############################################################################### | |
92 | |
93 like(http_get("/x1"), qr!200 OK.*param1=value1.*param2=data.*param3=value3!ms, | |
94 'params from xslt_stylesheet'); | |
1241
6b4c0c80cd00
Tests: added test for xslt_stylesheet configuration immutability.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
95 |
1242
1755891577af
Tests: xslt_params.t TODO adjusted, fix committed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1241
diff
changeset
|
96 # before 1.13.7, nginx used to overwrite xslt_stylesheet configuration data |
1755891577af
Tests: xslt_params.t TODO adjusted, fix committed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1241
diff
changeset
|
97 |
1241
6b4c0c80cd00
Tests: added test for xslt_stylesheet configuration immutability.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
98 TODO: { |
1242
1755891577af
Tests: xslt_params.t TODO adjusted, fix committed.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1241
diff
changeset
|
99 local $TODO = 'not yet' unless $t->has_version('1.13.7'); |
1241
6b4c0c80cd00
Tests: added test for xslt_stylesheet configuration immutability.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
100 |
6b4c0c80cd00
Tests: added test for xslt_stylesheet configuration immutability.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
101 like(http_get("/x1"), qr!200 OK.*param1=value1.*param2=data.*param3=value3!ms, |
6b4c0c80cd00
Tests: added test for xslt_stylesheet configuration immutability.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
102 'params from xslt_stylesheet again'); |
6b4c0c80cd00
Tests: added test for xslt_stylesheet configuration immutability.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
103 |
6b4c0c80cd00
Tests: added test for xslt_stylesheet configuration immutability.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
104 } |
6b4c0c80cd00
Tests: added test for xslt_stylesheet configuration immutability.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
105 |
208 | 106 like(http_get("/x2"), qr!200 OK.*param1=value1.*param2=data.*param3=value3!ms, |
107 'params from xslt_param/xslt_string_param'); | |
108 like(http_get("/x3"), qr!200 OK.*param1=value1.*param2=data.*param3=value3!ms, | |
109 'mixed'); | |
110 | |
111 ############################################################################### |