[Rt-commit] r8242 - in rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT:
Test
ruz at bestpractical.com
ruz at bestpractical.com
Fri Jul 20 18:48:49 EDT 2007
Author: ruz
Date: Fri Jul 20 18:48:49 2007
New Revision: 8242
Added:
rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test/
rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test/Web.pm
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm
Log:
* add RT::Test::Web
Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm Fri Jul 20 18:48:49 2007
@@ -105,10 +105,11 @@
}
sub started_ok {
+ require RT::Test::Web;
if ($existing_server) {
ok(1, "using existing server $existing_server");
warn $existing_server;
- return ($existing_server, Test::WWW::Mechanize->new);
+ return ($existing_server, RT::Test::Web->new);
}
my $s = RT::Interface::Web::Standalone->new($port);
push @server, $s;
@@ -116,7 +117,7 @@
$RT::Handle = new RT::Handle;
$RT::Handle->dbh( undef );
RT->ConnectToDatabase;
- return ($ret, Test::WWW::Mechanize->new);
+ return ($ret, RT::Test::Web->new);
}
sub _get_dbh {
Added: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test/Web.pm
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test/Web.pm Fri Jul 20 18:48:49 2007
@@ -0,0 +1,25 @@
+package RT::Test::Web;
+
+use strict;
+use warnings;
+
+use base qw(Test::WWW::Mechanize);
+
+sub rt_base_url {
+ return "http://localhost:" . RT->Config->Get('WebPort') . RT->Config->Get('WebPath') . "/";
+}
+
+sub login {
+ my $self = shift;
+ my $user = shift || 'root';
+ my $pass = shift || 'password';
+
+ my $url = $self->rt_base_url;
+
+ $self->get($url . "?user=$user;pass=$pass");
+ return 0 unless $self->status == 200;
+ return 0 unless $self->content =~ qr/Logout/;
+ return 1;
+}
+
+1;
More information about the Rt-commit
mailing list