ExtDirect/Test/Data/Env.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 20 CC 1 SCAR 6.9
CC
1
Cov
0%
get_tests
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # This does not need to be indexed by PAUSE
2 package
3 RPC::ExtDirect::Test::Data::Env;
4  
5 use strict;
6 use warnings;
7  
8 # This aref contains definitions/data for Env tests
9 my $tests = [{
10 name => 'http list',
11
12 config => {
13 api_path => '/api',
14 router_path => '/router',
15 poll_path => '/events',
16 debug => 1,
17
18 -cgi_env => {
19 HTTP_COOKIE => 'foo=bar',
20 },
21 },
22
23 input => {
24 method => 'POST',
25 url => '/router',
26 cgi_url => '/env',
27
28 content => {
29 type => 'raw_post',
30 arg => [
31 'http://localhost/router',
32 '{"type":"rpc","tid":1,"action":"Env",'.
33 ' "method":"http_list","data":[]}',
34 ],
35 },
36 },
37
38 output => {
39 status => 200,
40 content_type => qr|^application/json\b|,
41 comparator => 'cmp_json',
42 cgi_content_length => 167,
43 cgi_content =>
44 q|{"action":"Env","method":"http_list","result":|.
45 q|["http_accept","http_accept_charset","http_connection",|.
46 q|"http_cookie","http_host","http_user_agent"],|.
47 q|"tid":1,"type":"rpc"}|,
48 plack_content_length => 117,
49 plack_content =>
50 q|{"action":"Env","method":"http_list","result":|.
51 q|["content-length","content-type","cookie","host"],|.
52 q|"tid":1,"type":"rpc"}|,
53 anyevent_content_length => 110,
54 anyevent_content =>
55 q|{"action":"Env","method":"http_list","result":|.
56 q|["content-length","content-type","cookie"],|.
57 q|"tid":1,"type":"rpc"}|,
58 },
59 }, {
60 name => 'http header',
61
62 config => {
63 api_path => '/api',
64 router_path => '/router',
65 poll_path => '/events',
66 debug => 1,
67
68 -cgi_env => {
69 HTTP_COOKIE => 'foo=bar',
70 },
71 },
72
73 input => {
74 method => 'POST',
75 url => '/router',
76 cgi_url => '/env',
77
78 cgi_content => {
79 type => 'raw_post',
80 arg => [
81 'http://localhost/router',
82 '{"type":"rpc","tid":1,"action":"Env",'.
83 ' "method":"http_header","data":["HTTP_USER_AGENT"]}',
84 ],
85 },
86
87 content => {
88 type => 'raw_post',
89 arg => [
90 'http://localhost/router',
91 '{"type":"rpc","tid":1,"action":"Env",'.
92 ' "method":"http_header","data":["Content-Type"]}',
93 ],
94 }
95 },
96
97 output => {
98 status => 200,
99 content_type => qr|^application/json\b|,
100 comparator => 'cmp_json',
101 cgi_content_length => 81,
102 cgi_content =>
103 q|{"action":"Env","method":"http_header","result":|.
104 q|"CGI::Test",|.
105 q|"tid":1,"type":"rpc"}|,
106 content_length => 88,
107 content =>
108 q|{"action":"Env","method":"http_header","result":|.
109 q|"application/json",|.
110 q|"tid":1,"type":"rpc"}|,
111 },
112 }, {
113 name => 'param list',
114
115 config => {
116 api_path => '/api',
117 router_path => '/router',
118 poll_path => '/events',
119 debug => 1,
120
121 -cgi_env => {
122 HTTP_COOKIE => 'foo=bar',
123 },
124 },
125
126 input => {
127 method => 'POST',
128 url => '/router',
129 cgi_url => '/env',
130
131 content => {
132 type => 'raw_post',
133 arg => [
134 'http://localhost/router',
135 '{"type":"rpc","tid":1,"action":"Env",'.
136 ' "method":"param_list","data":[]}',
137 ],
138 },
139 },
140
141 output => {
142 status => 200,
143 content_type => qr|^application/json\b|,
144 comparator => 'cmp_json',
145 anyevent_content_length => 71,
146 anyevent_content =>
147 q|{"action":"Env","method":"param_list","result":|.
148 q|[],|.
149 q|"tid":1,"type":"rpc"}|,
150 content_length => 81,
151 content =>
152 q|{"action":"Env","method":"param_list","result":|.
153 q|["postdata"],|.
154 q|"tid":1,"type":"rpc"}|,
155 },
156 }, {
157 name => 'param get',
158
159 config => {
160 api_path => '/api',
161 router_path => '/router',
162 poll_path => '/events',
163 debug => 1,
164
165 -cgi_env => {
166 HTTP_COOKIE => 'foo=bar',
167 },
168 },
169
170 input => {
171 method => 'POST',
172 url => '/router',
173 cgi_url => '/env',
174
175 content => {
176 type => 'raw_post',
177 arg => [
178 'http://localhost/router',
179 '{"type":"rpc","tid":1,"action":"Env",'.
180 ' "method":"param_get","data":["POSTDATA"]}',
181 ],
182 },
183 },
184
185 output => {
186 status => 200,
187 content_type => qr|^application/json\b|,
188 comparator => 'cmp_json',
189 anyevent_content_length => 72,
190 anyevent_content =>
191 q|{"action":"Env","method":"param_get","result":|.
192 q|null,|.
193 q|"tid":1,"type":"rpc"}|,
194 content_length => 167,
195 content =>
196 q|{"action":"Env","method":"param_get","result":|.
197 q|"{\"type\":\"rpc\",\"tid\":1,\"action\":\"Env\",\"method\":\"param_get\",\"data\":[\"POSTDATA\"]}",|.
198 q|"tid":1,"type":"rpc"}|,
199 },
200 }, {
201 name => 'cookie list',
202
203 config => {
204 api_path => '/api',
205 router_path => '/router',
206 poll_path => '/events',
207 debug => 1,
208
209 -cgi_env => {
210 HTTP_COOKIE => 'foo=bar',
211 },
212 },
213
214 input => {
215 method => 'POST',
216 url => '/router',
217 cgi_url => '/env',
218
219 content => {
220 type => 'raw_post',
221 arg => [
222 'http://localhost/router',
223 '{"type":"rpc","tid":1,"action":"Env",'.
224 ' "method":"cookie_list","data":[]}',
225 ],
226 },
227 },
228
229 output => {
230 status => 200,
231 content_type => qr|^application/json\b|,
232 comparator => 'cmp_json',
233 content_length => 77,
234 content =>
235 q|{"action":"Env","method":"cookie_list","result":|.
236 q|["foo"],|.
237 q|"tid":1,"type":"rpc"}|,
238 },
239 }, {
240 name => 'cookie get',
241
242 config => {
243 api_path => '/api',
244 router_path => '/router',
245 poll_path => '/events',
246 debug => 1,
247
248 -cgi_env => {
249 HTTP_COOKIE => 'foo=bar',
250 },
251 },
252
253 input => {
254 method => 'POST',
255 url => '/router',
256 cgi_url => '/env',
257
258 content => {
259 type => 'raw_post',
260 arg => [
261 'http://localhost/router',
262 '{"type":"rpc","tid":1,"action":"Env",'.
263 ' "method":"cookie_get","data":["foo"]}',
264 ],
265 },
266 },
267
268 output => {
269 status => 200,
270 content_type => qr|^application/json\b|,
271 comparator => 'cmp_json',
272 content_length => 74,
273 content =>
274 q|{"action":"Env","method":"cookie_get","result":|.
275 q|"bar",|.
276 q|"tid":1,"type":"rpc"}|,
277 },
278 }];
279  
280 sub get_tests { return $tests };
281  
282 1;