first pass RT4 merge, RT#13852
[freeside.git] / rt / t / web / redirect-after-login.t
index d39bb58..d429d30 100644 (file)
@@ -3,7 +3,9 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 120;
+use RT::Test tests => 122;
+
+RT->Config->Set( GnuPG => Enable => 0 );
 
 my ($baseurl, $agent) = RT::Test->started_ok;
 
@@ -51,11 +53,9 @@ diag $url if $ENV{TEST_VERBOSE};
 
     ok( $agent->content =~ /Your username or password is incorrect/i, "Found the error message");
     like( $agent->uri, qr{/NoAuth/Login\.html$}, "now on /NoAuth/Login.html" );
-    $agent->logout();
-
-    # Handle the warning after we're done with the page, since this leaves us
-    # with a completely different $mech
     $agent->warning_like(qr/FAILED LOGIN for root/, "got failed login warning");
+
+    $agent->logout();
 }
 
 # test a login from a non-front page, both with a double leading slash and without
@@ -116,6 +116,7 @@ for my $path (qw(Prefs/Other.html /Prefs/Other.html)) {
 
     ok( $agent->content =~ /Your username or password is incorrect/i, "Found the error message");
     like( $agent->uri, qr{/NoAuth/Login\.html$}, "still on /NoAuth/Login.html" );
+    $agent->warning_like(qr/FAILED LOGIN for root/, "got failed login warning");
 
     # try to login again
     ok($agent->current_form->find_input('user'));
@@ -136,10 +137,6 @@ for my $path (qw(Prefs/Other.html /Prefs/Other.html)) {
     is( $agent->uri, $requested, "right URL" );
     like( $agent->{redirected_uri}, qr{/NoAuth/Login\.html}, "We redirected from login");
     $agent->logout();
-
-    # Handle the warning after we're done with the page, since this leaves us
-    # with a completely different $mech
-    $agent->warning_like(qr/FAILED LOGIN for root/, "got failed login warning");
 }
 
 # test a login from the main page with query params
@@ -163,9 +160,6 @@ for my $path (qw(Prefs/Other.html /Prefs/Other.html)) {
     ok($agent->current_form->find_input('user'));
     ok($agent->current_form->find_input('pass'));
     like($agent->current_form->action, qr{/NoAuth/Login\.html$}, "login form action is correct");
-    
-    # Handle the warning after we're done with the page, since this leaves us
-    # with a completely different $mech
     $agent->warning_like(qr/FAILED LOGIN for root/, "got failed login warning");
 }
 
@@ -183,6 +177,7 @@ for my $path (qw(Prefs/Other.html /Prefs/Other.html)) {
     ok($agent->current_form->find_input('next'));
     like($agent->value('next'), qr/^[a-z0-9]{32}$/i, "next page argument is a hash");
     like($agent->current_form->action, qr{/NoAuth/Login\.html$}, "login form action is correct");
+    $agent->warning_like(qr/FAILED LOGIN for root/, "got failed login warning");
 
     # Try to login again
     ok($agent->content =~ /username:/i);
@@ -197,10 +192,6 @@ for my $path (qw(Prefs/Other.html /Prefs/Other.html)) {
     is( $agent->uri, $requested, "right URL" );
     like( $agent->{redirected_uri}, qr{/NoAuth/Login\.html}, "We redirected from login");
     $agent->logout();
-
-    # Handle the warning after we're done with the page, since this leaves us
-    # with a completely different $mech
-    $agent->warning_like(qr/FAILED LOGIN for root/, "got failed login warning");
 }
 
 # test REST login response
@@ -221,9 +212,6 @@ for my $path (qw(Prefs/Other.html /Prefs/Other.html)) {
     is($agent->uri, $requested, "didn't redirect to /NoAuth/Login.html for REST");
     like($agent->content, qr/401 Credentials required/i, "got error status");
     like($agent->content, qr/Your username or password is incorrect/, "got error message");
-    
-    # Handle the warning after we're done with the page, since this leaves us
-    # with a completely different $mech
     $agent->warning_like(qr/FAILED LOGIN for root/, "got failed login warning");
 }