]> git.decadent.org.uk Git - maypole.git/blobdiff - t/maypole.t
+ Use HTTP::Headers for input/output headers. Add appropriate unit tests.
[maypole.git] / t / maypole.t
index a537732db572a608fe8726e04ea4fbe8f9234d3f..4da0de6bf3a823ff736a8203467cfebc6443be79 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Test::More tests => 103;
+use Test::More tests => 107;
 use Test::MockModule;
 
 # module compilation
@@ -14,6 +14,7 @@ ok($Maypole::VERSION, 'defines $VERSION');
 ok($INC{'Maypole/Config.pm'}, 'loads Maypole::Config');
 ok($INC{'UNIVERSAL/require.pm'}, 'loads UNIVERSAL::require');
 ok($INC{'Maypole/Constants.pm'}, 'loads Maypole::Constants');
+ok($INC{'Maypole/Headers.pm'}, 'loads Maypole::Headers');
 ok($INC{'Class/Accessor/Fast.pm'}, 'loads Class::Accessor::Fast');
 ok($INC{'Class/Data/Inheritable.pm'}, 'loads Class::Data::Inheritable');
 ok(Maypole->can('config'), 'defines a config attribute');
@@ -37,6 +38,8 @@ ok(Maypole->can('error'), 'defines an "error" accessor');
 ok(Maypole->can('document_encoding'), 'defines a "document_encoding" accessor');
 ok(Maypole->can('content_type'), 'defines a "content_type" accessor');
 ok(Maypole->can('table'), 'defines a "table" accessor');
+ok(Maypole->can('headers_in'), 'defines a "headers_in" accessor');
+ok(Maypole->can('headers_out'), 'defines a "headers_out" accessor');
 
 # simple test class that inherits from Maypole
 package MyDriver;
@@ -127,11 +130,13 @@ my ($r, $req); # request objects
     my $rv = $driver_class->handler();
     ok($r && $r->isa($driver_class), '... created $r');
     ok($called{get_request}, '... calls get_request()');
-    ok($called{get_request}, '... calls parse_location');
-    ok($called{get_request}, '... calls handler_guts()');
-    ok($called{get_request}, '... call send_output');
+    ok($called{parse_location}, '... calls parse_location');
+    ok($called{handler_guts}, '... calls handler_guts()');
+    ok($called{send_output}, '... call send_output');
     is($rv, 0, '... return status (should be ok?)');
     ok(!$init, "... doesn't call init() if init_done()");
+    ok($r->headers_out && $r->headers_out->isa('Maypole::Headers'),
+       '... populates headers_out() with a Maypole::Headers object');
     # call again, testing other branches
     $driver_class->init_done(0);
     $status = -1;