[Rt-commit] rt branch, 3.999-trunk, updated. 665f1e591dce53fd4ec1dc3fa7f8c2cc3c7bb63e

? sunnavy sunnavy at bestpractical.com
Tue Apr 6 03:20:41 EDT 2010


The branch, 3.999-trunk has been updated
       via  665f1e591dce53fd4ec1dc3fa7f8c2cc3c7bb63e (commit)
      from  4a50f3a382f98a19be5208309f462d26d2a81b1a (commit)

Summary of changes:
 t/web/basic.t              |   18 ++++++------------
 t/web/cf_access.t          |    4 ++--
 t/web/compilation_errors.t |   11 +++++------
 t/web/crypt-gnupg.t        |   16 ++++++++--------
 t/web/custom_frontpage.t   |   18 +++++++++---------
 t/web/custom_search.t      |   20 ++++++++++----------
 t/web/dashboards.t         |    4 ++--
 t/web/gnupg-outgoing.t     |    2 +-
 t/web/query_builder.t      |   12 ++++--------
 t/web/rights1.t            |    4 ++--
 10 files changed, 49 insertions(+), 60 deletions(-)

- Log -----------------------------------------------------------------
commit 665f1e591dce53fd4ec1dc3fa7f8c2cc3c7bb63e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Apr 6 15:20:18 2010 +0800

    $agent->get => $agent->get_ok

diff --git a/t/web/basic.t b/t/web/basic.t
index c7ce807..26a43d1 100644
--- a/t/web/basic.t
+++ b/t/web/basic.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
 use strict;
-use RT::Test strict => 0, tests => 23, l10n => 1;
+use RT::Test strict => 0, tests => 24, l10n => 1;
 use HTTP::Request::Common;
 use HTTP::Cookies;
 use LWP;
@@ -14,10 +14,7 @@ $agent->cookie_jar( HTTP::Cookies->new );
 # get the top page
 my $url = $agent->rt_base_url;
 diag $url if $ENV{TEST_VERBOSE};
-$agent->get($url);
-
-is ($agent->{'status'}, 200, "Loaded a page");
-
+$agent->get_ok($url);
 
 # {{{ test a login
 
@@ -35,8 +32,7 @@ ok($moniker, "Found the moniker $moniker");
 $agent->submit();
 is($agent->{'status'}, 200, "Fetched the page ok");
 ok( $agent->content =~ /Logout/i, "Found a logout link");
-$agent->get($url."/ticket/create?queue=1");
-is ($agent->{'status'}, 200, "Loaded Create.html");
+$agent->get_ok($url."/ticket/create?queue=1");
 # Start with a string containing characters in latin1
 my $string = "I18N Web Testing æøå";
 my $decoded_string = Encode::decode_utf8($string);
@@ -49,8 +45,7 @@ ok($agent->submit(), "Created new ticket with $string as content");
 like( $agent->{'content'}, qr{$string} , "Found the content");
 ok($agent->{redirected_uri}, "Did redirection");
 
-$agent->get($url."/ticket/create?queue=1");
-is ($agent->{'status'}, 200, "Loaded Create.html");
+$agent->get_ok($url."/ticket/create?queue=1");
 $agent->fill_in_action_ok('create_ticket', (
     'subject' => $decoded_string,
     'content' => "Ticket with utf8 subject",
@@ -69,9 +64,9 @@ $agent->submit;
 
 # {{{ test an image
 
+$agent->get_ok( $url."/static/images/test.png" );
 TODO: {
     todo_skip("Need to handle mason trying to compile images",1);
-$agent->get( $url."/static/images/test.png" );
 my $file = RT::Test::get_relocatable_file(
   File::Spec->catfile(
     qw(.. .. share web static images test.png)
@@ -91,8 +86,7 @@ is(
 # XXX: hey-ho, we have these tests in t/web/query-builder
 # TODO: move everything about QB there
 
-my $response = $agent->get($url."/Search/Build.html");
-ok( $response->is_success, "Fetched " . $url."Search/Build.html" );
+$agent->get_ok($url."/Search/Build.html");
 
 # Parsing TicketSQL
 #
diff --git a/t/web/cf_access.t b/t/web/cf_access.t
index 69ffcfa..1d88c75 100644
--- a/t/web/cf_access.t
+++ b/t/web/cf_access.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use RT::Test strict => 1, tests => 21, l10n => 1;
+use RT::Test strict => 1, tests => 22, l10n => 1;
 
 $RT::Test::SKIP_REQUEST_WORK_AROUND = 1;
 
@@ -128,7 +128,7 @@ diag "create a ticket with an image" if $ENV{'TEST_VERBOSE'};
     }
 }
 
-$m->get( $m->rt_base_url );
+$m->get_ok( $m->rt_base_url );
 $m->follow_link( text => 'Tickets' );
 $m->follow_link( text => 'New Query' );
 
diff --git a/t/web/compilation_errors.t b/t/web/compilation_errors.t
index fe277d6..4590d9a 100644
--- a/t/web/compilation_errors.t
+++ b/t/web/compilation_errors.t
@@ -9,8 +9,8 @@ sub wanted {
 
 my $tests;
 BEGIN {
-$tests = 2;
-find ( sub { wanted() and $tests += 4 } , 'share/html/');
+$tests = 4;
+find ( sub { wanted() and $tests += 3 } , 'share/html/');
 }
 
 use RT::Test tests => $tests, strict => 1;
@@ -30,7 +30,7 @@ $agent->cookie_jar($cookie_jar);
 # get the top page
 my $url = $agent->rt_base_url;
 diag "base URL is '$url'" if $ENV{TEST_VERBOSE};
-$agent->get($url);
+$agent->get_ok($url);
 
 # {{{ test a login
 $agent->login(root => 'password');
@@ -44,8 +44,7 @@ sub test_get {
 
         $file =~ s#^share/html/##;
         diag( "testing $url/$file" ) if $ENV{TEST_VERBOSE};
-        ok ($agent->get("$url/$file", "GET $url/$file"), "Can Get $url/$file");
-        is ($agent->{'status'}, 200, "Loaded $file");
+        $agent->get_ok("$url/$file", "GET $url/$file");
 #        ok( $agent->{'content'} =~ /Logout/i, "Found a logout link on $file ");
         ok( $agent->{'content'} !~ /Not logged in/i, "Still logged in for  $file");
         ok( $agent->{'content'} !~ /raw error/i, "Didn't get a Mason compilation error on $file");
@@ -55,6 +54,6 @@ sub test_get {
 
 # it's predictable that we will get a lot of warnings because some pages need 
 # mandatory arguments, let's not show the warnings 
-$agent->get( '/__jifty/test_warnings' );
+$agent->get_ok( '/__jifty/test_warnings' );
 
 1;
diff --git a/t/web/crypt-gnupg.t b/t/web/crypt-gnupg.t
index 95a7f73..a79de25 100644
--- a/t/web/crypt-gnupg.t
+++ b/t/web/crypt-gnupg.t
@@ -9,7 +9,7 @@ plan skip_all => 'GnuPG required.'
 plan skip_all => 'gpg executable is required.'
     unless RT::Test->find_executable('gpg');
 
-plan tests => 61;
+plan tests => 100;
 
 use RT::ScripAction::SendEmail;
 
@@ -97,7 +97,7 @@ ok(!$sign->value, "sign tick box is unchecked");
 $m->submit;
 is($m->status, 200, "request successful");
 
-$m->get($baseurl); # ensure that the mail has been processed
+$m->get_ok($baseurl); # ensure that the mail has been processed
 
 my @mail = RT::Test->fetch_caught_mails;
 ok(@mail, "got some mail");
@@ -166,7 +166,7 @@ ok($sign->value, "sign tick box is checked");
 $m->submit;
 is($m->status, 200, "request successful");
 
-$m->get($baseurl); # ensure that the mail has been processed
+$m->get_ok($baseurl); # ensure that the mail has been processed
 
 @mail = RT::Test->fetch_caught_mails;
 ok(@mail, "got some mail");
@@ -239,7 +239,7 @@ ok($encrypt->value, "encrypt tick box is checked");
 ok($sign->value, "sign tick box is checked");
 $m->submit;
 is($m->status, 200, "request successful");
-$m->get($baseurl); # ensure that the mail has been processed
+$m->get_ok($baseurl); # ensure that the mail has been processed
 
 @mail = RT::Test->fetch_caught_mails;
 ok(@mail, "got some mail");
@@ -311,7 +311,7 @@ ok($sign->value, "sign tick box is still checked");
 $m->submit;
 is($m->status, 200, "request successful");
 
-$m->get($baseurl); # ensure that the mail has been processed
+$m->get_ok($baseurl); # ensure that the mail has been processed
 @mail = RT::Test->fetch_caught_mails;
 ok(@mail, "got some mail");
 for my $mail (@mail) {
@@ -417,7 +417,7 @@ $user->set_email('general at example.com');
 ok($user = RT::Model::User->new(current_user => RT->system_user));
 ok($user->load('root'), "Loaded user 'root'");
 is($user->preferred_key, $key1, "preferred key is set correctly");
-$m->get("$baseurl/prefs/other");
+$m->get_ok("$baseurl/prefs/other");
 $m->content_like( qr/Preferred key/, "preferred key option shows up in preference");
 
 # XXX: mech doesn't let us see the current value of the select, apparently
@@ -431,7 +431,7 @@ ok($user = RT::Model::User->new(current_user => RT->system_user));
 ok($user->load('root'), "Loaded user 'root'");
 is($user->preferred_key, $key2, "preferred key is set correctly to the new value");
 
-$m->get("$baseurl/prefs/other");
+$m->get_ok("$baseurl/prefs/other");
 $m->content_like( qr/Preferred key/, "preferred key option shows up in preference");
 
 # XXX: mech doesn't let us see the current value of the select, apparently
@@ -440,7 +440,7 @@ $m->content_like( qr/$key1/, "first key shows up in preferences");
 $m->content_like( qr/$key2.*?$key1/s, "second key (now preferred) shows up before the first");
 
 # test that the new fields work
-$m->get("$baseurl/Search/Simple.html?q=General");
+$m->get_ok("$baseurl/Search/Simple.html?q=General");
 my $content = $m->content;
 $content =~ s/&#40;/(/g;
 $content =~ s/&#41;/)/g;
diff --git a/t/web/custom_frontpage.t b/t/web/custom_frontpage.t
index 737f2fd..a2c1f51 100644
--- a/t/web/custom_frontpage.t
+++ b/t/web/custom_frontpage.t
@@ -2,7 +2,7 @@
 use strict;
 
 use RT::Test strict  => 1;
-use Test::More tests => 9;
+use Test::More tests => 15;
 
 my ( $baseurl, $m ) = RT::Test->started_ok;
 
@@ -22,7 +22,7 @@ $user_object->principal->grant_right( right => 'ModifySelf' );
 
 ok $m->login( 'customer' => 'customer' ), "logged in";
 
-$m->get( $url . "/Search/Build.html" );
+$m->get_ok( $url . "/Search/Build.html" );
 
 #create a saved search
 $m->form_name('build_query');
@@ -31,25 +31,25 @@ $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->get_ok( $url . '/prefs/my_rt' );
 $m->content_like( qr/stupid tickets/,
     'saved search listed in rt at a glance items' );
 
 ok $m->login, 'we did log in as root';
 
-$m->get( $url . '/prefs/my_rt' );
 my $moniker = 'prefs_config_my_rt';
 
-# can't use submit form for mutli-valued select as it uses set_fields
-$m->fill_in_action_ok( $moniker, body => undef );
+$m->get_ok( $url . '/prefs/my_rt' );
+# remove system-My Tickets
+$m->fill_in_action_ok( $moniker, body => 'system-QuickCreate' );
 $m->submit;
-$m->get($url);
+$m->get_ok($url);
 $m->content_lacks( 'highest priority tickets',
     'remove everything from body pane' );
 
-$m->get( $url . '/prefs/my_rt' );
+$m->get_ok( $url . '/prefs/my_rt' );
 $m->fill_in_action_ok( $moniker, body => 'system-My Tickets', );
 $m->submit;
-$m->get($url);
+$m->get_ok($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 967a54d..41da039 100644
--- a/t/web/custom_search.t
+++ b/t/web/custom_search.t
@@ -2,7 +2,7 @@
 use strict;
 
 use RT::Test strict  => 1;
-use Test::More tests => 14;
+use Test::More tests => 23;
 
 my ( $baseurl, $m ) = RT::Test->started_ok;
 my $url = $m->rt_base_url;
@@ -24,10 +24,10 @@ like( $t_link->url, qr/$id/, 'link to the ticket we Created' );
 
 $m->content_lacks( 'customsearch at localhost', 'requestor not displayed ' );
 
-$m->get( $url . '/prefs/my_rt' );
+$m->get_ok( $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->get_ok($cus_hp);
 $m->content_like(qr'Customize Search');
 
 # add Requestor to the fields
@@ -40,11 +40,11 @@ $m->click_button( name => 'add_col' );
 $m->form_name('prefs_edit_search_options');
 $m->click_button( name => 'J:A:F-save-prefs_edit_search_options' );
 
-$m->get($url);
+$m->get_ok($url);
 $m->content_contains( 'customsearch at localhost', 'requestor now displayed ' );
 
 # now remove Requestor from the fields
-$m->get($cus_hp);
+$m->get_ok($cus_hp);
 
 $m->form_name('prefs_edit_search_options');
 my $cdc = $m->current_form->find_input('current_display_columns');
@@ -58,7 +58,7 @@ $m->click_button( name => 'remove_col' );
 $m->form_name('prefs_edit_search_options');
 $m->click_button( name => 'J:A:F-save-prefs_edit_search_options' );
 
-$m->get($url);
+$m->get_ok($url);
 $m->content_lacks( 'customsearch at localhost', 'requestor not displayed ' );
 
 # try to disable General from quick search
@@ -68,11 +68,11 @@ $m->content_lacks( 'customsearch at localhost', 'requestor not displayed ' );
 # queue added during the quicksearch setting will be unticked.
 my $nlinks = $#{ $m->find_all_links( text => "General" ) };
 
-$m->get($cus_qs);
+$m->get_ok($cus_qs);
 $m->fill_in_action_ok('prefs_edit_quick_search', queues => 0);
 $m->submit;
 
-$m->get($url);
+$m->get_ok($url);
 is(
     $#{ $m->find_all_links( text => "General" ) },
     $nlinks - 1,
@@ -80,10 +80,10 @@ is(
 );
 
 # get it back
-$m->get($cus_qs);
+$m->get_ok($cus_qs);
 $m->fill_in_action_ok('prefs_edit_quick_search', queues => 'General');
 $m->submit;
 
-$m->get($url);
+$m->get_ok($url);
 is( $#{ $m->find_all_links( text => "General" ) },
     $nlinks, 'General back in quicksearch list' );
diff --git a/t/web/dashboards.t b/t/web/dashboards.t
index 4d81ea7..6ed913f 100644
--- a/t/web/dashboards.t
+++ b/t/web/dashboards.t
@@ -2,7 +2,7 @@
 use strict;
 
 use RT::Test strict => 1, l10n => 1;
-plan tests => 97;
+plan tests => 98;
 use RT::Dashboard;
 my ($baseurl, $m) = RT::Test->started_ok;
 
@@ -192,7 +192,7 @@ $m->form_name( 'modify_dashboard' );
 $m->click_button(name => 'delete');
 $m->content_contains("Deleted dashboard $id");
 
-$m->get("/Dashboards/Modify.html?id=$id");
+$m->get_ok("/Dashboards/Modify.html?id=$id");
 $m->content_lacks("different dashboard", "dashboard was deleted");
 $m->content_contains("Failed to load dashboard $id");
 $m->no_warnings_ok;
diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index 48fa812..053de64 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -10,7 +10,7 @@ plan skip_all => 'GnuPG required.'
 plan skip_all => 'gpg executable is required.'
     unless RT::Test->find_executable('gpg');
 
-plan tests => 381;
+plan tests => 453;
 
 use RT::ScripAction::SendEmail;
 use File::Temp qw(tempdir);
diff --git a/t/web/query_builder.t b/t/web/query_builder.t
index 24f46de..c655839 100644
--- a/t/web/query_builder.t
+++ b/t/web/query_builder.t
@@ -25,8 +25,7 @@ ok $agent->login, "logged in";
 
 # {{{ Query Builder tests
 
-my $response = $agent->get($url."/Search/Build.html");
-ok $response->is_success, "Fetched ". $url ."Search/Build.html";
+$agent->get_ok($url."/Search/Build.html");
 
 sub get_query_from_form {
     $agent->form_name('build_query');
@@ -144,8 +143,7 @@ diag "Add a condition into a nested block" if $ENV{'TEST_VERBOSE'};
 diag "click advanced, enter 'C1 OR ( C2 AND C3 )', apply, aggregators should stay the same."
     if $ENV{'TEST_VERBOSE'};
 {
-    my $response = $agent->get($url."/Search/Edit.html");
-    ok( $response->is_success, "Fetched /Search/Edit.html" );
+    $agent->get_ok($url."/Search/Edit.html");
     ok($agent->form_name('query_edit'), "found the form");
     $agent->field("query", "Status = 'new' OR ( Status = 'open' AND subject LIKE 'office' )");
     $agent->submit;
@@ -212,8 +210,7 @@ diag "click advanced, enter 'C1 OR ( C2 AND C3 )', apply, aggregators should sta
         );
         ok($return, 'Created CF') or diag "error: $msg";
     }
-    $response = $agent->get($url."/Search/Build.html?new_query=1");
-    ok( $response->is_success, "Fetched " . $url."/Search/Build.html" );
+    $agent->get_ok($url."/Search/Build.html?new_query=1");
 
     ok($agent->form_name('build_query'), "found the form once");
     $agent->field("ValueOf'CF.{\x{442}}'", "\x{441}");
@@ -232,8 +229,7 @@ TODO: {
 diag "input a condition, select (several conditions), click delete"
     if $ENV{'TEST_VERBOSE'};
 {
-    my $response = $agent->get( $url."/Search/Edit.html" );
-    ok $response->is_success, "Fetched /Search/Edit.html";
+    $agent->get_ok( $url."/Search/Edit.html" );
     ok $agent->form_name('query_edit'), "found the form";
     $agent->field("query", "( Status = 'new' OR Status = 'open' )");
     $agent->submit;
diff --git a/t/web/rights1.t b/t/web/rights1.t
index 137e0b1..161e1ae 100644
--- a/t/web/rights1.t
+++ b/t/web/rights1.t
@@ -2,7 +2,7 @@
 use strict;
 use HTTP::Cookies;
 
-use RT::Test strict => 0, tests => 31;
+use RT::Test strict => 0, tests => 32;
 
 my ($baseurl, $agent) = RT::Test->started_ok;
 
@@ -43,7 +43,7 @@ my ($grantid,$grantmsg) =$user_obj->principal->grant_right(right => 'ShowConfigT
 ok($grantid,$grantmsg);
 
 # instead of $agent->reload so $agent won't try to login again
-$agent->get( $agent->uri ); 
+$agent->get_ok( $agent->uri ); 
 
 like($agent->{'content'} , qr/Logout/i, "Reloaded page successfully");
 ok($agent->find_link( url => RT->config->get('web_path') . "/admin/",

-----------------------------------------------------------------------


More information about the Rt-commit mailing list