[Rt-commit] r15918 - in rt/3.8/trunk: t/web

sartak at bestpractical.com sartak at bestpractical.com
Thu Sep 11 05:04:51 EDT 2008


Author: sartak
Date: Thu Sep 11 05:04:24 2008
New Revision: 15918

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/t/web/dashboards.t

Log:
 r71654 at onn:  sartak | 2008-09-11 05:04:02 -0400
 Catch and test warnings in t/web/dashboards


Modified: rt/3.8/trunk/t/web/dashboards.t
==============================================================================
--- rt/3.8/trunk/t/web/dashboards.t	(original)
+++ rt/3.8/trunk/t/web/dashboards.t	Thu Sep 11 05:04:24 2008
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use Test::More tests => 96;
+use Test::More tests => 110;
 use RT::Test;
 my ($baseurl, $m) = RT::Test->started_ok;
 
@@ -38,10 +38,14 @@
 $m->get_ok($url."Dashboards/index.html");
 $m->content_lacks("New dashboard", "No 'new dashboard' link because we have no CreateOwnDashboard");
 
+$m->no_warnings_ok;
+
 $m->get_ok($url."Dashboards/Modify.html?Create=1");
 $m->content_contains("Permission denied");
 $m->content_lacks("Save Changes");
 
+$m->warning_like(qr/Permission denied/, "got a permission denied warning");
+
 $user_obj->PrincipalObj->GrantRight(Right => 'ModifyOwnDashboard', Object => $RT::System);
 
 # Modify itself is no longer good enough, you need Create
@@ -49,6 +53,8 @@
 $m->content_contains("Permission denied");
 $m->content_lacks("Save Changes");
 
+$m->warning_like(qr/Permission denied/, "got a permission denied warning");
+
 $user_obj->PrincipalObj->GrantRight(Right => 'CreateOwnDashboard', Object => $RT::System);
 
 $m->get_ok($url."Dashboards/Modify.html?Create=1");
@@ -143,6 +149,7 @@
 $m->form_name('SubscribeDashboard');
 $m->click_button(name => 'Save');
 $m->content_contains("Permission denied");
+$m->warning_like(qr/Unable to subscribe to dashboard.*Permission denied/, "got a permission denied warning when trying to subscribe to a dashboard");
 
 RT::Record->FlushCache if RT::Record->can('FlushCache');
 is($user_obj->Attributes->Named('Subscription'), 0, "no subscriptions");
@@ -174,6 +181,8 @@
 $m->get_ok("/Dashboards/Modify.html?id=$id&Delete=1");
 $m->content_contains("Permission denied", "unable to delete dashboard because we lack DeleteOwnDashboard");
 
+$m->warning_like(qr/Couldn't delete dashboard.*Permission denied/, "got a permission denied warning when trying to delete the dashboard");
+
 $user_obj->PrincipalObj->GrantRight(Right => 'DeleteOwnDashboard', Object => $RT::System);
 
 $m->get_ok("/Dashboards/Modify.html?id=$id");
@@ -187,6 +196,8 @@
 $m->content_lacks("different dashboard", "dashboard was deleted");
 $m->content_contains("Failed to load dashboard $id");
 
+$m->warning_like(qr/Failed to load dashboard.*Couldn't find row/, "the dashboard was deleted");
+
 $user_obj->PrincipalObj->GrantRight(Right => "SuperUser", Object => $RT::System);
 
 # now test that we warn about searches others can't see
@@ -235,3 +246,6 @@
 $omech->follow_link_ok({text => 'system dashboard'});
 $omech->content_lacks("personal search", "saved search doesn't show up");
 $omech->content_lacks("dashboard test", "matched ticket doesn't show up");
+
+$m->warning_like(qr/User .* tried to load container user /, "can't see other users' personal searches");
+


More information about the Rt-commit mailing list