[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-337-g74428a7
Ruslan Zakirov
ruz at bestpractical.com
Tue Apr 6 12:22:31 EDT 2010
The branch, 3.8-trunk has been updated
via 74428a7e5ee979a53996cf19b5f062b6281b3f7a (commit)
via dae897995bc1ec8af2a2a55634b4aa04675c6989 (commit)
from 5ff5d0799db013fe2e30b07a6e36e31ce54b4995 (commit)
Summary of changes:
lib/RT/Test/Web.pm | 37 ++++++++++++++++++++++++++++++-------
share/html/NoAuth/Logout.html | 2 +-
2 files changed, 31 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit dae897995bc1ec8af2a2a55634b4aa04675c6989
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Apr 6 15:29:07 2010 +0400
use more checks in tests' login and logout functions
diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index 9e3d6ae..fb31797 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -76,23 +76,46 @@ sub login {
my $self = shift;
my $user = shift || 'root';
my $pass = shift || 'password';
+
+ $self->logout;
my $url = $self->rt_base_url;
+ $self->get($url . "?user=$user;pass=$pass");
+ unless ( $self->status == 200 ) {
+ Test::More::diag( "error: status is ". $self->status );
+ return 0;
+ }
+ unless ( $self->content =~ qr/Logout/i ) {
+ Test::More::diag("error: page has no Logout");
+ return 0;
+ }
+ unless ( $self->content =~ m{<span>\Q$user\E</span>}i ) {
+ Test::More::diag("Page has no user name");
+ return 0;
+ }
+ return 1;
+}
+sub logout {
+ my $self = shift;
+
+ my $url = $self->rt_base_url;
$self->get($url);
Test::More::diag( "error: status is ". $self->status )
unless $self->status == 200;
+
if ( $self->content =~ qr/Logout/i ) {
$self->follow_link( text => 'Logout' );
+ Test::More::diag( "error: status is ". $self->status ." when tried to logout" )
+ unless $self->status == 200;
}
-
- $self->get($url . "?user=$user;pass=$pass");
- unless ( $self->status == 200 ) {
- Test::More::diag( "error: status is ". $self->status );
- return 0;
+ else {
+ return 1;
}
- unless ( $self->content =~ qr/Logout/i ) {
- Test::More::diag("error: page has no Logout");
+
+ $self->get($url);
+ if ( $self->content =~ qr/Logout/i ) {
+ Test::More::diag( "error: couldn't logout" );
return 0;
}
return 1;
commit 74428a7e5ee979a53996cf19b5f062b6281b3f7a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Apr 6 15:47:24 2010 +0400
defined(%session) is deprecated
diff --git a/share/html/NoAuth/Logout.html b/share/html/NoAuth/Logout.html
index 9f01aa2..7b80823 100755
--- a/share/html/NoAuth/Logout.html
+++ b/share/html/NoAuth/Logout.html
@@ -70,7 +70,7 @@
my $URL = RT->Config->Get('WebPath')."/";
$m->callback( %ARGS, CallbackName => 'BeforeSessionDelete' );
-if (defined %session) {
+if (keys %session) {
tied(%session)->delete;
$session{'CurrentUser'} = RT::CurrentUser->new;
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list