[Rt-commit] r2696 - in rt/branches/PLATANO-EXPERIMENTAL-CSS: . html/Search lib/t/regression

jesse at bestpractical.com jesse at bestpractical.com
Sat Apr 16 04:15:22 EDT 2005


Author: jesse
Date: Sat Apr 16 04:15:21 2005
New Revision: 2696

Modified:
   rt/branches/PLATANO-EXPERIMENTAL-CSS/   (props changed)
   rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Search/Build.html
   rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/18custom_frontpage.t
Log:
 r13085 at hualien:  jesse | 2005-04-16 03:01:49 -0400
  r12982 at hualien:  jesse | 2005-04-16 02:23:06 -0400
   r8817 at hualien:  jesse | 2005-03-16 23:59:40 -0500
    r8804 at hualien (orig r2472):  clkao | 2005-03-16 01:31:43 -0500
    Make the error more readable and prevent side-effect on failed
    savesearch.
    r8805 at hualien (orig r2473):  clkao | 2005-03-16 01:47:42 -0500
    Test if saved search is listed in available items in RT at a glance
    preferences.
   
  
 


Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Search/Build.html
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Search/Build.html	(original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/html/Search/Build.html	Sat Apr 16 04:15:21 2005
@@ -774,20 +774,21 @@
                     RowsPerPage => $RowsPerPage,
                 }
             );
-            $search =
-              $session{'CurrentUser'}->UserObj->Attributes->WithId($search_id);
-
-            # Build new SearchId
-            $SearchId =
-                ref( $session{'CurrentUser'}->UserObj ) . '-'
-              . $session{'CurrentUser'}->UserObj->Id
-              . '-SavedSearch-'
-              . $search->Id;
-        }
-        unless ( $search->id ) {
-            push @actions, [ loc("Can't find a saved search to work with"), 0 ];
-        }
+	    if ( $search_id ) {
+		$search =
+		    $session{'CurrentUser'}->UserObj->Attributes->WithId($search_id);
+		# Build new SearchId
+		$SearchId =
+		    ref( $session{'CurrentUser'}->UserObj ) . '-'
+			. $session{'CurrentUser'}->UserObj->Id
+			. '-SavedSearch-'
+			. $search->Id;
+	    }
+	    else {
+		push @actions, [ loc("Can't find a saved search to work with").': '.loc($search_msg), 0 ];
+	    }
 
+	}
     }
     else {
         push @actions, [ loc("Can't save this search"), 0 ];

Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/18custom_frontpage.t
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/18custom_frontpage.t	(original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/t/regression/18custom_frontpage.t	Sat Apr 16 04:15:21 2005
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use Test::More tests => 4;
+use Test::More tests => 7;
 BEGIN {
     use RT;
     RT::LoadConfig;
@@ -12,11 +12,39 @@
 $RT::WebPath ||= ''; # Shut up a warning
 use constant BaseURL => "http://localhost:".$RT::WebPort.$RT::WebPath."/";
 
-# reset preferences for easier test?
+
+my $user_obj = RT::User->new($RT::SystemUser);
+my ($ret, $msg) = $user_obj->LoadOrCreateByEmail('customer at example.com');
+ok($ret, 'ACL test user creation');
+$user_obj->SetName('customer');
+$user_obj->SetPrivileged(1);
+($ret, $msg) = $user_obj->SetPassword('customer');
+$user_obj->PrincipalObj->GrantRight(Right => 'LoadSavedSearch');
+$user_obj->PrincipalObj->GrantRight(Right => 'EditSavedSearch');
+$user_obj->PrincipalObj->GrantRight(Right => 'CreateSavedSearch');
+$user_obj->PrincipalObj->GrantRight(Right => 'ModifySelf');
 
 my $m = Test::WWW::Mechanize->new ( autocheck => 1 );
 isa_ok($m, 'Test::WWW::Mechanize');
 
+$m->get( BaseURL."?user=customer;pass=customer" );
+
+$m->content_like(qr/Logout/, 'we did log in');
+
+$m->get ( BaseURL."Search/Build.html");
+
+#create a saved search
+$m->form_name ('BuildQuery');
+
+$m->field ( "ValueOfAttachment" => 'stupid');
+$m->field ( "Description" => 'stupid tickets');
+$m->click_button (name => 'Save');
+
+$m->get ( BaseURL.'Prefs/MyRT.html' );
+$m->content_like (qr/stupid tickets/, 'saved search listed in rt at a glance items');
+
+$m->follow_link (text => 'Logout');
+
 $m->get( BaseURL."?user=root;pass=password" );
 $m->content_like(qr/Logout/, 'we did log in');
 


More information about the Rt-commit mailing list