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