[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-198-gfafce42

? sunnavy sunnavy at bestpractical.com
Wed Nov 17 01:34:01 EST 2010


The branch, 3.8-trunk has been updated
       via  fafce4240c4c791f4f60314e19c91dbd72b2361d (commit)
      from  1c027193b6315ed8beacbad52ac20745a8d92e91 (commit)

Summary of changes:
 t/web/basic.t              |   11 ++---------
 t/web/compilation_errors.t |   12 ++----------
 t/web/rights1.t            |   28 ++--------------------------
 3 files changed, 6 insertions(+), 45 deletions(-)

- Log -----------------------------------------------------------------
commit fafce4240c4c791f4f60314e19c91dbd72b2361d
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Aug 23 18:52:49 2010 -0400

    Replace older login infrastructure from a few test files with RT core
    login routines that don't break on new WWW::Mechanize

diff --git a/t/web/basic.t b/t/web/basic.t
index bc4d655..3f94e73 100644
--- a/t/web/basic.t
+++ b/t/web/basic.t
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use Encode;
 
-use RT::Test tests => 24;
+use RT::Test tests => 21;
 $RT::Test::SKIP_REQUEST_WORK_AROUND = 1;
 
 my ($baseurl, $agent) = RT::Test->started_ok;
@@ -20,15 +20,8 @@ diag $url if $ENV{TEST_VERBOSE};
 
 # test a login
 {
-    ok($agent->{form}->find_input('user'));
-    ok($agent->{form}->find_input('pass'));
-
-    ok($agent->{'content'} =~ /username:/i);
-    $agent->field( 'user' => 'root' );
-    $agent->field( 'pass' => 'password' );
-
+    $agent->login('root' => 'password');
     # the field isn't named, so we have to click link 0
-    $agent->click(0);
     is( $agent->{'status'}, 200, "Fetched the page ok");
     ok( $agent->{'content'} =~ /Logout/i, "Found a logout link");
 }
diff --git a/t/web/compilation_errors.t b/t/web/compilation_errors.t
index 46a8628..4fd9c40 100644
--- a/t/web/compilation_errors.t
+++ b/t/web/compilation_errors.t
@@ -7,7 +7,7 @@ BEGIN {
     sub wanted {
         -f && /\.html$/ && $_ !~ /Logout.html$/;
     }
-    my $tests = 7;
+    my $tests = 4;
     find( sub { wanted() and $tests += 4 }, 'share/html/' );
     plan tests => $tests;
 }
@@ -36,15 +36,7 @@ is ($agent->{'status'}, 200, "Loaded a page");
 # {{{ test a login
 
 # follow the link marked "Login"
-
-ok($agent->{form}->find_input('user'));
-
-ok($agent->{form}->find_input('pass'));
-like ($agent->{'content'} , qr/username:/i);
-$agent->field( 'user' => 'root' );
-$agent->field( 'pass' => 'password' );
-# the field isn't named, so we have to click link 0
-$agent->click(0);
+$agent->login(root => 'password');
 is($agent->{'status'}, 200, "Fetched the page ok");
 like( $agent->{'content'} , qr/Logout/i, "Found a logout link");
 
diff --git a/t/web/rights1.t b/t/web/rights1.t
index 6da204c..c8892f2 100644
--- a/t/web/rights1.t
+++ b/t/web/rights1.t
@@ -2,7 +2,7 @@
 use strict;
 use HTTP::Cookies;
 
-use RT::Test tests => 35;
+use RT::Test tests => 29;
 my ($baseurl, $agent) = RT::Test->started_ok;
 
 # Create a user with basically no rights, to start.
@@ -26,7 +26,7 @@ $agent->cookie_jar($cookie_jar);
 
 no warnings 'once';
 # get the top page
-login($agent, $user_obj);
+$agent->login( $user_obj->Name, 'customer');
 
 # Test for absence of Configure and Preferences tabs.
 ok(!$agent->find_link( url => "$RT::WebPath/Admin/",
@@ -107,28 +107,4 @@ ok($agent->form_name('BuildQuery'), "Yep, form is still there");
 my $input = $agent->current_form->find_input('ValueOfActor');
 ok(grep(/customer-$$/, $input->value_names()), "Found self in the actor listing");
 
-sub login {
-    my $agent = shift;
-
-    my $url = "http://localhost:" . RT->Config->Get('WebPort') . RT->Config->Get('WebPath') . "/";
-    $agent->get($url);
-    is( $agent->{'status'}, 200,
-        "Loaded a page - http://localhost" . RT->Config->Get('WebPath') );
-
-    # {{{ test a login
-
-    # follow the link marked "Login"
-
-    ok( $agent->{form}->find_input('user') );
-
-    ok( $agent->{form}->find_input('pass') );
-    like( $agent->{'content'} , qr/username:/i );
-    $agent->field( 'user' => $user_obj->Name );
-    $agent->field( 'pass' => 'customer' );
-
-    # the field isn't named, so we have to click link 0
-    $agent->click(0);
-    is( $agent->{'status'}, 200, "Fetched the page ok" );
-    like( $agent->{'content'} , qr/Logout/i, "Found a logout link" );
-}
 1;

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


More information about the Rt-commit mailing list