[Rt-commit] r12123 - in rt/branches/3.8-TESTING: . html/Dashboards
sartak at bestpractical.com
sartak at bestpractical.com
Tue May 6 22:43:43 EDT 2008
Author: sartak
Date: Tue May 6 22:43:43 2008
New Revision: 12123
Modified:
rt/branches/3.8-TESTING/ (props changed)
rt/branches/3.8-TESTING/html/Dashboards/Subscription.html
rt/branches/3.8-TESTING/t/web/dashboards.t
Log:
r55152 at onn: sartak | 2008-05-06 22:43:20 -0400
Tests for subscriptions
Modified: rt/branches/3.8-TESTING/html/Dashboards/Subscription.html
==============================================================================
--- rt/branches/3.8-TESTING/html/Dashboards/Subscription.html (original)
+++ rt/branches/3.8-TESTING/html/Dashboards/Subscription.html Tue May 6 22:43:43 2008
@@ -53,7 +53,7 @@
<& /Elements/ListActions, actions => \@results &>
-<form action="<%$RT::WebPath%>/Dashboards/Subscription.html" method="post" enctype="multipart/form-data">
+<form action="<%$RT::WebPath%>/Dashboards/Subscription.html" method="post" enctype="multipart/form-data" name="SubscribeDashboard">
<input type="hidden" class="hidden" name="DashboardId" value="<% $fields{'DashboardId'} %>" />
<table width="100%" border="0">
<tr>
@@ -153,11 +153,11 @@
</table>
% if ($SubscriptionObj->Id) {
- <& /Elements/Submit, Label => loc('Save Changes') &>
+ <& /Elements/Submit, Name => "Save", Label => loc('Save Changes') &>
<br />
<& /Elements/Submit, Name => "Unsubscribe", Label => loc('Unsubscribe') &>
% } else {
- <& /Elements/Submit, Label => loc('Subscribe') &>
+ <& /Elements/Submit, Name => "Save", Label => loc('Subscribe') &>
% }
</form>
@@ -222,7 +222,7 @@
# this'll be defined on submit
-if (defined $ARGS{Frequency}) {
+if (defined $ARGS{Save}) {
# update
if ($SubscriptionObj->Id) {
$DashboardId = delete $fields{'DashboardId'}; # immutable
@@ -248,7 +248,7 @@
);
}
else {
- $msg = "No permission to subscribe to dashboards";
+ ($val, $msg) = (0, "No permission to subscribe to dashboards");
}
if ($val) {
push @results, loc("Subscribed to dashboard [_1]", $DashboardObj->Name);
Modified: rt/branches/3.8-TESTING/t/web/dashboards.t
==============================================================================
--- rt/branches/3.8-TESTING/t/web/dashboards.t (original)
+++ rt/branches/3.8-TESTING/t/web/dashboards.t Tue May 6 22:43:43 2008
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 32;
+use Test::More tests => 46;
use RT::Test;
my ($baseurl, $m) = RT::Test->started_ok;
@@ -16,6 +16,12 @@
$user_obj->PrincipalObj->GrantRight(Right => 'ModifySelf');
my $currentuser = RT::CurrentUser->new($user_obj);
+my $queue = RT::Queue->new($RT::SystemUser);
+$queue->Create(Name => 'SearchQueue'.$$);
+$user_obj->PrincipalObj->GrantRight(Right => 'SeeQueue', Object => $queue);
+$user_obj->PrincipalObj->GrantRight(Right => 'ShowTicket', Object => $queue);
+$user_obj->PrincipalObj->GrantRight(Right => 'OwnTicket', Object => $queue);
+
ok $m->login(customer => 'customer'), "logged in";
$m->get_ok($url."Dashboards/index.html");
@@ -81,3 +87,34 @@
is(@searches, 2, "two saved searches in the dashboard");
like($searches[0]->Name, qr/newest unowned tickets/, "correct existing search name");
like($searches[1]->Name, qr/highest priority tickets I own/, "correct new search name");
+
+my $ticket = RT::Ticket->new($RT::SystemUser);
+$ticket->Create(
+ Queue => $queue->Id,
+ Requestor => [ $user_obj->Name ],
+ Owner => $user_obj,
+ Subject => 'dashboard test',
+);
+
+$m->follow_link_ok({text => "Preview"});
+$m->content_contains("20 highest priority tickets I own");
+$m->content_contains("20 newest unowned tickets");
+$m->content_lacks("Bookmarked Tickets");
+$m->content_contains("dashboard test", "ticket subject");
+
+$m->get_ok("/Dashboards/$id/This fragment left intentionally blank");
+$m->content_contains("20 highest priority tickets I own");
+$m->content_contains("20 newest unowned tickets");
+$m->content_lacks("Bookmarked Tickets");
+$m->content_contains("dashboard test", "ticket subject");
+
+$m->get_ok("/Dashboards/Subscription.html?DashboardId=$id");
+$m->form_name('SubscribeDashboard');
+$m->click_button(name => 'Save');
+$m->content_contains("No permission to subscribe to dashboards");
+
+$user_obj->PrincipalObj->GrantRight(Right => 'SubscribeDashboard');
+
+$m->get_ok("/Dashboards/Modify.html?id=$id");
+$m->follow_link_ok({text => "Subscription"});
+$m->save_content('test.html');
More information about the Rt-commit
mailing list