Commit | Line | Data |
21a20b7e |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use FindBin '$Bin'; |
7 | use lib "$Bin/lib"; |
8 | |
f410f043 |
9 | use Test::More tests => 8; |
21a20b7e |
10 | |
11 | use Catalyst::Test 'TestCGIBin'; |
12 | use HTTP::Request::Common; |
13 | |
46a4350c |
14 | # this should be ignored |
15 | $ENV{MOD_PERL} = "mod_perl/2.0"; |
16 | |
9cc2dd4c |
17 | my $response = request POST '/my-bin/path/test.pl', [ |
21a20b7e |
18 | foo => 'bar', |
19 | bar => 'baz' |
20 | ]; |
21 | |
22 | is($response->content, 'foo:bar bar:baz', 'POST to Perl CGI File'); |
23 | |
bdb35995 |
24 | $response = request POST '/my-bin/exit.pl', [ |
25 | name => 'world', |
26 | ]; |
27 | |
28 | is($response->content, 'hello world', 'POST to Perl CGI with exit()'); |
29 | |
30 | $response = request POST '/my-bin/exit.pl', [ |
31 | name => 'world', |
32 | exit => 17, |
33 | ]; |
34 | |
35 | is($response->code, 500, 'POST to Perl CGI with nonzero exit()'); |
36 | |
21a20b7e |
37 | $response = request POST '/cgihandler/dongs', [ |
38 | foo => 'bar', |
39 | bar => 'baz' |
40 | ]; |
41 | |
42 | is($response->content, 'foo:bar bar:baz', |
43 | 'POST to Perl CGI File through a forward'); |
44 | |
45 | $response = request POST '/cgihandler/mtfnpy', [ |
46 | foo => 'bar', |
47 | bar => 'baz' |
48 | ]; |
49 | |
50 | is($response->content, 'foo:bar bar:baz', |
51 | 'POST to Perl CGI File through a forward via cgi_action'); |
52 | |
63096ad1 |
53 | $response = request '/my-bin/path/testdata.pl'; |
fbaba9dd |
54 | is($response->content, "testing\n", |
55 | 'scripts with __DATA__ sections work'); |
56 | |
f410f043 |
57 | $response = request '/my-bin/pathinfo.pl/path/info'; |
58 | is($response->content, '/path/info', |
59 | 'PATH_INFO works'); |
60 | |
21a20b7e |
61 | SKIP: { |
62 | skip "Can't run shell scripts on non-*nix", 1 |
63 | if $^O eq 'MSWin32' || $^O eq 'VMS'; |
64 | |
9cc2dd4c |
65 | is(get('/my-bin/test.sh'), "Hello!\n", 'Non-Perl CGI File'); |
21a20b7e |
66 | } |