add test for Operation::Auth dispatch
This commit is contained in:
parent
3c0a6aa22f
commit
9395985570
1 changed files with 33 additions and 1 deletions
|
|
@ -43,6 +43,10 @@ sub callable {
|
|||
return "callable";
|
||||
}
|
||||
|
||||
sub not_callable {
|
||||
return "not callable";
|
||||
}
|
||||
|
||||
sub www_verify {
|
||||
return "verify";
|
||||
}
|
||||
|
|
@ -52,7 +56,7 @@ package main;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 7; # Increment this number for each test you create
|
||||
plan tests => 10; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test the getInstance method
|
||||
|
|
@ -105,4 +109,32 @@ unlike(
|
|||
"Hidden form elements for login NOT displayed to valid user",
|
||||
);
|
||||
|
||||
# Go back to visitor and test callable dispatch
|
||||
$session->user({ userId => 1 });
|
||||
$session->request->setup_body({
|
||||
authType => 'TestAuth',
|
||||
method => 'callable',
|
||||
});
|
||||
eval { $output = WebGUI::Operation::Auth::www_auth( $session ); };
|
||||
like( $output, qr{\bcallable\b}, 'Callable method is callable' );
|
||||
|
||||
# Test a method not in callable
|
||||
$session->user({ userId => 1 });
|
||||
$session->request->setup_body({
|
||||
authType => 'TestAuth',
|
||||
method => 'not_callable',
|
||||
});
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $error = $i18n->get(1077);
|
||||
eval { $output = WebGUI::Operation::Auth::www_auth( $session ); };
|
||||
like( $output, qr{$error}, 'not_callable method gives error message' );
|
||||
|
||||
# Test www_ dispatch
|
||||
$session->user({ userId => 1 });
|
||||
$session->request->setup_body({
|
||||
authType => 'TestAuth',
|
||||
method => 'verify',
|
||||
});
|
||||
eval { $output = WebGUI::Operation::Auth::www_auth( $session ); };
|
||||
like( $output, qr{verify}, 'www_ callable without being setCallable' );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue