6a49d5904be97f9f190a213664f44da3ac2af4e0
[catagits/Catalyst-Controller-WrapCGI.git] / t / wrap-cgi.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin '$Bin';
7 use lib "$Bin/lib";
8
9 use Test::More tests => 5;
10
11 use Catalyst::Test 'TestApp';
12 use HTTP::Request::Common;
13
14 my $response = request POST '/cgi-bin/test.cgi', [
15     foo => 'bar',
16     bar => 'baz'
17 ];
18
19 is($response->content, 'foo:bar bar:baz', 'POST to CGI');
20
21 $response = request POST '/cgi-bin/test.cgi', [
22   foo => 'bar',
23   bar => 'baz',
24 ], 'Content-Type' => 'form-data';
25
26 is($response->content, 'foo:bar bar:baz', 'POST to CGI (form-data)');
27
28 $response = request '/cgi-bin/test_pathinfo.cgi/path/%2Finfo';
29 is($response->content, '/path/%2Finfo', 'PATH_INFO is correct');
30
31 $response = request '/cgi-bin/test_filepathinfo.cgi/path/%2Finfo';
32 is($response->content, '/test_filepath_info/path/%2Finfo',
33     'FILEPATH_INFO is correct (maybe)');
34
35 $response = request '/cgi-bin/test_scriptname.cgi/foo/bar';
36 is($response->content, '/cgi-bin/test_scriptname.cgi',
37     'SCRIPT_NAME is correct');