Prepare a test method for throwing Template exceptions. Add code to handle HTTP 304 for visitors.

This commit is contained in:
Colin Kuskie 2010-08-03 16:49:24 -07:00
parent 08f453475e
commit 25fb019a18
3 changed files with 58 additions and 11 deletions

View file

@ -30,6 +30,8 @@ BEGIN {
package WebGUI::Asset::TestDispatch;
use WebGUI::Asset;
use WebGUI::Exception;
our @ISA = ('WebGUI::Asset');
# Override dispatch to handle special /foo URL
@ -55,6 +57,15 @@ sub www_alsoView {
return;
}
sub www_brokenTemplate {
my $self = shift;
WebGUI::Error::ObjectNotFound::Template->throw(
error => qq{Template not found},
templateId => "This is a GUID",
assetId => $self->getId,
);
}
package main;
my $tag = WebGUI::VersionTag->getWorking( $session );
@ -100,7 +111,7 @@ is( $td->dispatch, "www_view", "requests for non-existant methods return www_vie
$session->request->setup_body( {
func => 'alsoView',
} );
is( $td->dispatch, "www_view", "if a query method return undef, view is still returned" );
is( $td->dispatch, "www_view", "if a query method returns undef, view is still returned" );
$session->request->setup_body( { } );
$output = $td->dispatch( '/not-foo' );