increase Privilege coverage to 100%
This commit is contained in:
parent
f9958fa4eb
commit
f113d0a729
1 changed files with 23 additions and 3 deletions
|
|
@ -54,8 +54,9 @@ my @simpleTests = (
|
|||
);
|
||||
|
||||
my $num_tests = 1;
|
||||
$num_tests += 3 * scalar @simpleTests; ##For each simple privilege validation
|
||||
$num_tests += 4 * scalar @simpleTests; ##For each simple privilege validation
|
||||
$num_tests += 3; ##For noAccess as Visitor tests
|
||||
$num_tests += 4; ##For insufficient with noStyle=1
|
||||
|
||||
plan tests => $num_tests;
|
||||
|
||||
|
|
@ -88,9 +89,28 @@ foreach my $test (@simpleTests) {
|
|||
is($session->http->getStatusDescription(), $test->{description}, "$method: description");
|
||||
my $title = $i18n->get($test->{titleCode});
|
||||
like($output, qr{<h1>$title</h1>}, "$method: correct title");
|
||||
like($output, qr{^USERSTYLE}, "$method: renders in WebGUI User Style");
|
||||
}
|
||||
|
||||
##Now, retest noAccess with Visitor and see if we get an auth-type screen
|
||||
|
||||
####################################################
|
||||
#
|
||||
# insufficient with empty style
|
||||
#
|
||||
####################################################
|
||||
|
||||
my $output = $privilege->insufficient(1);
|
||||
is($session->http->getStatus(), '401', 'insufficient: status code with Visitor');
|
||||
is($session->http->getStatusDescription(), 'Insufficient Privileges', 'insufficient: description with Visitor');
|
||||
my $title = $i18n->get(37);
|
||||
unlike($output, qr{^USERSTYLE}, "insufficient: when noStyle is true the user style is not used");
|
||||
like($output, qr{<h1>$title</h1>}, "insufficient: when noStyle is true the title is still okay");
|
||||
|
||||
####################################################
|
||||
#
|
||||
# noAccess when the user is the Visitor
|
||||
#
|
||||
####################################################
|
||||
|
||||
$session->user({userId=>1});
|
||||
|
||||
|
|
@ -111,7 +131,7 @@ sub setup_assets {
|
|||
url => 'user_style_printable',
|
||||
namespace => 'Style',
|
||||
##Note, at this point
|
||||
template => "<tmpl_var body.content>",
|
||||
template => "USERSTYLE:<tmpl_var body.content>",
|
||||
id => 'printableUser0Template',
|
||||
# '1234567890123456789012'
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue