fix require, in the presence of PERL_USE_UNSAFE_INC=0
[catagits/Web-Simple.git] / t / bloggery.t
CommitLineData
957088cd 1use strict;
2use warnings FATAL => 'all';
53d47b78 3
4use Test::More qw(no_plan);
5
2a4efe48 6require_ok './examples/bloggery/bloggery.cgi';
53d47b78 7
8__END__
4ed4fb42 9#use Test::More (
10# eval { require HTTP::Request::AsCGI }
11# ? 'no_plan'
12## : (skip_all => 'No HTTP::Request::AsCGI')
13#);
14use HTTP::Request::AsCGI;
957088cd 15
16use HTTP::Request::Common qw(GET POST);
17
18require 'examples/bloggery/bloggery.cgi';
19
20my $app = Bloggery->new(
21 { config => { posts_dir => 'examples/bloggery/posts' } }
22);
23
24sub run_request {
25 my $request = shift;
4ed4fb42 26 my $c = HTTP::Request::AsCGI->new($request, SCRIPT_NAME=> $0)->setup;
957088cd 27 $app->run;
28 $c->restore;
29 return $c->response;
30}
31
32my $res;
33
39119082 34warn run_request(GET 'http://localhost/index.html')->as_string;
957088cd 35
39119082 36warn run_request(GET 'http://localhost/')->as_string;
957088cd 37
38warn run_request(GET 'http://localhost/One-Post.html')->as_string;
39
40warn run_request(GET 'http://localhost/Not-There.html')->as_string;
41
42warn run_request(POST 'http://localhost/One-Post.html')->as_string;