diff options
author | ivan <ivan> | 2010-05-18 18:49:59 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-05-18 18:49:59 +0000 |
commit | 624b2d44625f69d71175c3348cae635d580c890b (patch) | |
tree | ed57a90db2ecbc72cea6c1d3c175c1dcd1938ab4 /rt/lib/RT/Test | |
parent | 7f4aff45cd6ef2f630d538294fa9d9c4db4ac4aa (diff) | |
parent | e70abd21bab68b23488f7ef1ee2e693a3b365691 (diff) |
This commit was generated by cvs2svn to compensate for changes in r9232,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'rt/lib/RT/Test')
-rw-r--r-- | rt/lib/RT/Test/Web.pm | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/rt/lib/RT/Test/Web.pm b/rt/lib/RT/Test/Web.pm index 9e3d6ae0c..fb3179770 100644 --- a/rt/lib/RT/Test/Web.pm +++ b/rt/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; |