diff --git a/t/Session/Privilege.t b/t/Session/Privilege.t index 351e0658c..6c2042002 100644 --- a/t/Session/Privilege.t +++ b/t/Session/Privilege.t @@ -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{

$title

}, "$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{

$title

}, "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 => "", + template => "USERSTYLE:", id => 'printableUser0Template', # '1234567890123456789012' };