[Rt-commit] rt branch, admin_ui, updated. 2b6e47d76d697dcb30625da808a1504d937a46d3
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Fri Jan 22 00:21:12 EST 2010
The branch, admin_ui has been updated
via 2b6e47d76d697dcb30625da808a1504d937a46d3 (commit)
from 2d9e7d64bd2b126e7c3c8bef2fd141200f6a6039 (commit)
Summary of changes:
t/web/custom_frontpage.t | 96 +++++++++++----------------------
t/web/custom_search.t | 131 ++++++++++++++++++++++-----------------------
2 files changed, 96 insertions(+), 131 deletions(-)
- Log -----------------------------------------------------------------
commit 2b6e47d76d697dcb30625da808a1504d937a46d3
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jan 22 13:21:04 2010 +0800
update tests
diff --git a/t/web/custom_frontpage.t b/t/web/custom_frontpage.t
index 89e75e1..1c4e85f 100644
--- a/t/web/custom_frontpage.t
+++ b/t/web/custom_frontpage.t
@@ -1,85 +1,53 @@
#!/usr/bin/perl -w
use strict;
-use RT::Test strict => 1; use Test::More tests => 7;
+use RT::Test strict => 1;
+use Test::More tests => 7;
-my ($baseurl, $m) = RT::Test->started_ok;
+my ( $baseurl, $m ) = RT::Test->started_ok;
my $url = $m->rt_base_url;
-my $user_object = RT::Model::User->new(current_user => RT->system_user);
-my ($ret, $msg) = $user_object->load_or_create_by_email('customer at example.com');
-ok($ret, 'ACL test user creation');
+my $user_object = RT::Model::User->new( current_user => RT->system_user );
+my ( $ret, $msg ) =
+ $user_object->load_or_create_by_email('customer at example.com');
+ok( $ret, 'ACL test user creation' );
$user_object->set_name('customer');
$user_object->set_privileged(1);
-($ret, $msg) = $user_object->set_password('customer');
-$user_object->principal->grant_right(right => 'LoadSavedSearch');
-$user_object->principal->grant_right(right => 'EditSavedSearches');
-$user_object->principal->grant_right(right => 'CreateSavedSearch');
-$user_object->principal->grant_right(right => 'ModifySelf');
+( $ret, $msg ) = $user_object->set_password('customer');
+$user_object->principal->grant_right( right => 'LoadSavedSearch' );
+$user_object->principal->grant_right( right => 'EditSavedSearches' );
+$user_object->principal->grant_right( right => 'CreateSavedSearch' );
+$user_object->principal->grant_right( right => 'ModifySelf' );
ok $m->login( 'customer' => 'customer' ), "logged in";
-$m->get ( $url."/Search/Build.html");
+$m->get( $url . "/Search/Build.html" );
#create a saved search
$m->form_name('build_query');
-$m->field ( "value_of_attachment" => 'stupid');
-$m->field ( "saved_search_description" => 'stupid tickets');
-$m->click_button (name => 'saved_search_save');
+$m->field( "value_of_attachment" => 'stupid' );
+$m->field( "saved_search_description" => 'stupid tickets' );
+$m->click_button( name => 'saved_search_save' );
+$m->get( $url . '/prefs/my_rt' );
+$m->content_like( qr/stupid tickets/,
+ 'saved search listed in rt at a glance items' );
-SKIP: {
+ok $m->login, 'we did log in as root';
- # use skip instead of todo because the following code will die with todo
- skip '/Prefs/MyRT.html need to be refactored to use ConfigMyRT action', 4;
- $m->get( $url . '/Prefs/MyRT.html' );
- $m->content_like( qr/stupid tickets/,
- 'saved search listed in rt at a glance items' );
+$m->get( $url . '/prefs/my_rt' );
+my $moniker = 'prefs_config_my_rt';
- ok $m->login, 'we did log in as root';
+# can't use submit form for mutli-valued select as it uses set_fields
+$m->fill_in_action_ok( $moniker, body => undef );
+$m->submit;
+$m->get($url);
+$m->content_lacks( 'highest priority tickets',
+ 'remove everything from body pane' );
- $m->get( $url . '/Prefs/MyRT.html' );
- $m->form_name('SelectionBox-body');
-
- # can't use submit form for mutli-valued select as it uses set_fields
- $m->field(
- 'body-Selected' => [
- 'component-QuickCreate',
- 'system-Unowned Tickets',
- 'system-My Tickets'
- ]
- );
- $m->click_button( name => 'remove' );
- $m->form_name('SelectionBox-body');
-
- #$m->click_button (name => 'body-Save');
- $m->get($url);
- $m->content_lacks( 'highest priority tickets',
- 'remove everything from body pane' );
-
- $m->get( $url . '/Prefs/MyRT.html' );
- $m->form_name('SelectionBox-body');
- $m->field(
- 'body-Available' => [
- 'component-QuickCreate',
- 'system-Unowned Tickets',
- 'system-My Tickets'
- ]
- );
- $m->click_button( name => 'add' );
-
- $m->form_name('SelectionBox-body');
- $m->field( 'body-Selected' => ['component-QuickCreate'] );
- $m->click_button( name => 'movedown' );
-
- $m->form_name('SelectionBox-body');
- $m->click_button( name => 'movedown' );
-
- $m->form_name('SelectionBox-body');
-
- #$m->click_button (name => 'body-Save');
- $m->get($url);
- $m->content_like( qr'highest priority tickets', 'adds them back' );
-}
+$m->get( $url . '/prefs/my_rt' );
+$m->fill_in_action_ok( $moniker, body => 'system-Unowned Tickets', );
+$m->get($url);
+$m->content_like( qr'highest priority tickets', 'adds them back' );
diff --git a/t/web/custom_search.t b/t/web/custom_search.t
index d2f8c3a..23b9a38 100644
--- a/t/web/custom_search.t
+++ b/t/web/custom_search.t
@@ -1,93 +1,90 @@
#!/usr/bin/perl -w
use strict;
-use RT::Test strict => 1; use Test::More tests => 12;
+use RT::Test strict => 1;
+use Test::More tests => 12;
-my ($baseurl, $m) = RT::Test->started_ok;
+my ( $baseurl, $m ) = RT::Test->started_ok;
my $url = $m->rt_base_url;
# reset preferences for easier test?
-
-
-my $t = RT::Model::Ticket->new(current_user => RT->system_user);
-my ($tkid,$txnid, $msg) = $t->create(subject => 'for custom search'.$$, queue => 'general',
- owner => 'root', requestor => 'customsearch at localhost');
-ok(my $id = $t->id, 'Created ticket for custom search');
-ok($tkid, $msg);
+my $t = RT::Model::Ticket->new( current_user => RT->system_user );
+my ( $tkid, $txnid, $msg ) = $t->create(
+ subject => 'for custom search' . $$,
+ queue => 'general',
+ owner => 'root',
+ requestor => 'customsearch at localhost'
+);
+ok( my $id = $t->id, 'Created ticket for custom search' );
+ok( $tkid, $msg );
ok $m->login, 'logged in';
-my $t_link = $m->find_link( text => "for custom search".$$ );
-like ($t_link->url, qr/$id/, 'link to the ticket we Created');
-
-$m->content_lacks ('customsearch at localhost', 'requestor not displayed ');
+my $t_link = $m->find_link( text => "for custom search" . $$ );
+like( $t_link->url, qr/$id/, 'link to the ticket we Created' );
-SKIP: {
- # use skip instead of todo because the following code will die with todo
+$m->content_lacks( 'customsearch at localhost', 'requestor not displayed ' );
- skip '/Prefs/MyRT.html need to be refactored to use ConfigMyRT action', 6;
- $m->get( $url . '/Prefs/MyRT.html' );
- my $cus_hp = $m->find_link( text => "My Tickets" );
- my $cus_qs = $m->find_link( text => "Quick search" );
- $m->get($cus_hp);
- $m->content_like(qr'highest priority tickets');
+$m->get( $url . '/prefs/my_rt' );
+my $cus_hp = $m->find_link( text => "My Tickets" );
+my $cus_qs = $m->find_link( text => "Quick search" );
+$m->get($cus_hp);
+$m->content_like(qr'highest priority tickets');
- # add Requestor to the fields
- $m->form_name('build_query');
+# add Requestor to the fields
+$m->form_name('build_query');
- # can't use submit form for mutli-valued select as it uses set_fields
- $m->field( select_display_columns => ['requestors'] );
- $m->click_button( name => 'add_col' );
+# can't use submit form for mutli-valued select as it uses set_fields
+$m->field( select_display_columns => ['requestors'] );
+$m->click_button( name => 'add_col' );
- $m->form_name('build_query');
- $m->click_button( name => 'save' );
+$m->form_name('build_query');
+$m->click_button( name => 'save' );
- $m->get($url);
- $m->content_contains( 'customsearch at localhost',
- 'requestor now displayed ' );
+$m->get($url);
+$m->content_contains( 'customsearch at localhost', 'requestor now displayed ' );
- # now remove Requestor from the fields
- $m->get($cus_hp);
+# now remove Requestor from the fields
+$m->get($cus_hp);
- $m->form_name('build_query');
+$m->form_name('build_query');
- my $cdc = $m->current_form->find_input('current_display_columns');
- my ($requestor_value) = grep { /requestor/ } $cdc->possible_values;
- ok( $requestor_value, "got the requestor value" );
+my $cdc = $m->current_form->find_input('current_display_columns');
+my ($requestor_value) = grep { /requestor/ } $cdc->possible_values;
+ok( $requestor_value, "got the requestor value" );
- $m->field( current_display_columns => $requestor_value );
- $m->click_button( name => 'remove_col' );
+$m->field( current_display_columns => $requestor_value );
+$m->click_button( name => 'remove_col' );
- $m->form_name('build_query');
- $m->click_button( name => 'save' );
+$m->form_name('build_query');
+$m->click_button( name => 'save' );
- $m->get($url);
- $m->content_lacks( 'customsearch at localhost', 'requestor not displayed ' );
+$m->get($url);
+$m->content_lacks( 'customsearch at localhost', 'requestor not displayed ' );
- # try to disable General from quick search
+# try to disable General from quick search
- # Note that there's a small problem in the current implementation,
- # since ticked quese are wanted, we do the invesrsion. So any
- # queue added during the quicksearch setting will be unticked.
- my $nlinks = $#{ $m->find_all_links( text => "General" ) };
- $m->get($cus_qs);
- $m->form_name('preferences');
- $m->untick( 'Want-General', '1' );
- $m->click_button( name => 'save' );
+# Note that there's a small problem in the current implementation,
+# since ticked quese are wanted, we do the invesrsion. So any
+# queue added during the quicksearch setting will be unticked.
+my $nlinks = $#{ $m->find_all_links( text => "General" ) };
+$m->get($cus_qs);
+$m->form_name('preferences');
+$m->untick( 'Want-General', '1' );
+$m->click_button( name => 'save' );
- $m->get($url);
- is(
- $#{ $m->find_all_links( text => "General" ) },
- $nlinks - 1,
- 'General gone from quicksearch list'
- );
+$m->get($url);
+is(
+ $#{ $m->find_all_links( text => "General" ) },
+ $nlinks - 1,
+ 'General gone from quicksearch list'
+);
- # get it back
- $m->get($cus_qs);
- $m->form_name('preferences');
- $m->tick( 'Want-General', '1' );
- $m->click_button( name => 'save' );
+# get it back
+$m->get($cus_qs);
+$m->form_name('preferences');
+$m->tick( 'Want-General', '1' );
+$m->click_button( name => 'save' );
- $m->get($url);
- is( $#{ $m->find_all_links( text => "General" ) },
- $nlinks, 'General back in quicksearch list' );
-}
+$m->get($url);
+is( $#{ $m->find_all_links( text => "General" ) },
+ $nlinks, 'General back in quicksearch list' );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list